[gimp] app: make sure all tool options widgets are properly destroyed



commit bbd4038e98b3b8b4e1e310479673b1e3be83080d
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jun 23 22:48:53 2010 +0200

    app: make sure all tool options widgets are properly destroyed
    
    ...and with them all references their widgets keep (which are a lot).
    
    Take ownership of the widget after creating it, so it can be reliably
    unrefed upon exit.

 app/tools/gimp-tools.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c
index 12e7cf6..0b6f38d 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -213,6 +213,7 @@ void
 gimp_tools_exit (Gimp *gimp)
 {
   GList *default_order;
+  GList *list;
 
   g_return_if_fail (GIMP_IS_GIMP (gimp));
 
@@ -224,6 +225,19 @@ gimp_tools_exit (Gimp *gimp)
 
   g_object_set_data (G_OBJECT (gimp), "gimp-tools-default-order", NULL);
 
+  for (list = gimp_get_tool_info_iter (gimp);
+       list;
+       list = g_list_next (list))
+    {
+      GimpToolInfo *tool_info = list->data;
+      GtkWidget    *options_gui;
+
+      options_gui = g_object_get_data (G_OBJECT (tool_info->tool_options),
+                                       "gimp-tool-options-gui");
+
+      g_object_unref (options_gui);
+    }
+
   tool_manager_exit (gimp);
 }
 
@@ -342,7 +356,8 @@ gimp_tools_restore (Gimp *gimp)
         }
 
       g_object_set_data (G_OBJECT (tool_info->tool_options),
-                         "gimp-tool-options-gui", options_gui);
+                         "gimp-tool-options-gui",
+                         g_object_ref_sink (options_gui));
 
       if (tool_info->presets)
         gimp_tool_presets_load (tool_info->presets, NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]