From 819a81d86d9b736d9bf5f576618cb92c13d2b4c1 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 14 Oct 2014 04:17:56 +0200 Subject: [PATCH] Suppress GUI shutdown crashes(#937, #172) This is not really a solution, but kind of narrowes down the problem. Our GUI uses an obsolete C-ish approach at releasing resources at several points. This is probably a left-over from earlier days. Especially since we started out with libGDL without C++ wrappers. And at that time, we didn't use smart-pointers, as we should do, but we tried to do things manually, which is an approach which never works in an event driven and condition based environment. Goto fail. Here I just commented out the manual clean-up code from several dtors. The real solution would be not to allocate these resources through the raw C calls at first place, but rather use the mm-wrappers and leave it to them to unwind at the right moment. TODO: - scan the GUI code for *every* instance where we still muck around with gobjects and either replace that by a mm-wrapper, or wrap it in a smart handle. - make sure that *all* dtors are either empty, or really airtight and EX_FREE --- src/gui/workspace/panel-manager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/workspace/panel-manager.cpp b/src/gui/workspace/panel-manager.cpp index b985aba28..2e5ce3e99 100644 --- a/src/gui/workspace/panel-manager.cpp +++ b/src/gui/workspace/panel-manager.cpp @@ -62,12 +62,16 @@ PanelManager::PanelManager(WorkspaceWindow &workspace_window) : PanelManager::~PanelManager() { + ///////////////////////////////////////////////////////TICKET #195 : violation of policy, dtors must not do any work + ///////////////////////////////////////////////////////TICKET #172 : observed as a reason for crashes when closing the GUI. It was invoked after end of main, when the GUI as already gone. +#if false /////////////////////////////////////////////////TICKET #937 : disabled for GTK-3 transition. TODO investigate why this logic existed... for(int i = 0; i < 4; i++) if(dockPlaceholders[i]) g_object_unref(dockPlaceholders[i]); clear_panels(); +#endif /////////////////////////////////////////////////TICKET #937 : (End)disabled for GTK-3 transition. } void @@ -311,6 +315,8 @@ PanelManager::remove_panel(panels::Panel* const panel) void PanelManager::clear_panels() { + ///////////////////////////////////////////////////////TICKET #195 : this whole approach smells like an obsolete "C-style" approach. We should strive to let the runtime system do such stuff for us whenever possible, eg. by using smart pointers + list< panels::Panel* >::iterator i; for(i = panels.begin(); i != panels.end(); i++) delete *i;