[gimp/soc-2010-cage] app: make sure all tool options widgets are properly destroyed



commit 9cfa249d837ca5259d1499d8b2c9fe9628695753
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 9b1c8c9..64847f4 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -215,6 +215,7 @@ void
 gimp_tools_exit (Gimp *gimp)
 {
   GList *default_order;
+  GList *list;
 
   g_return_if_fail (GIMP_IS_GIMP (gimp));
 
@@ -226,6 +227,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);
 }
 
@@ -344,7 +358,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]