[gimp] app: disconnect from the dialog factory in dispose() instead of finalize()



commit 39c74059545d492e3c5ef953ae3ad2d26b342316
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 24 13:00:16 2010 +0200

    app: disconnect from the dialog factory in dispose() instead of finalize()

 app/display/gimpimagewindow.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index c2852a6..ff8dfc2 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -112,6 +112,7 @@ typedef struct
 static GObject * gimp_image_window_constructor         (GType                type,
                                                         guint                n_params,
                                                         GObjectConstructParam *params);
+static void      gimp_image_window_dispose             (GObject             *object);
 static void      gimp_image_window_finalize            (GObject             *object);
 static void      gimp_image_window_set_property        (GObject             *object,
                                                         guint                property_id,
@@ -206,6 +207,7 @@ gimp_image_window_class_init (GimpImageWindowClass *klass)
   GtkWidgetClass *widget_class     = GTK_WIDGET_CLASS (klass);
 
   object_class->constructor        = gimp_image_window_constructor;
+  object_class->dispose            = gimp_image_window_dispose;
   object_class->finalize           = gimp_image_window_finalize;
   object_class->set_property       = gimp_image_window_set_property;
   object_class->get_property       = gimp_image_window_get_property;
@@ -383,6 +385,23 @@ gimp_image_window_constructor (GType                  type,
 }
 
 static void
+gimp_image_window_dispose (GObject *object)
+{
+  GimpImageWindow        *window  = GIMP_IMAGE_WINDOW (object);
+  GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
+
+  if (private->dialog_factory)
+    {
+      g_signal_handlers_disconnect_by_func (private->dialog_factory,
+                                            gimp_image_window_update_ui_manager,
+                                            window);
+      private->dialog_factory = NULL;
+    }
+
+  G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
 gimp_image_window_finalize (GObject *object)
 {
   GimpImageWindow        *window  = GIMP_IMAGE_WINDOW (object);
@@ -394,10 +413,6 @@ gimp_image_window_finalize (GObject *object)
       private->menubar_manager = NULL;
     }
 
-  g_signal_handlers_disconnect_by_func (private->dialog_factory,
-                                        gimp_image_window_update_ui_manager,
-                                        window);
-
   if (private->shells)
     {
       g_list_free (private->shells);



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