[gimp] app: Ref dockables in DnD signal code



commit f8410035f1cf66db4960ea16b93601e8d3427312
Author: Martin Nordholts <martinn src gnome org>
Date:   Tue Jan 5 10:26:07 2010 +0100

    app: Ref dockables in DnD signal code
    
    Use g_signal_connect_object() instead of g_signal_connect() so that
    the dockable is referenced and not destroyed before
    _drag_end(). Prevents a crash, but DnD in single-window mode does not
    work properly yet.

 app/widgets/gimpdockbook.c |   44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c
index e972693..0105c35 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -617,33 +617,33 @@ gimp_dockbook_create_tab_widget (GimpDockbook *dockbook,
 
   gimp_dockbook_tab_drag_source_setup (tab_widget, dockable);
 
-  g_signal_connect (tab_widget, "drag-begin",
-                    G_CALLBACK (gimp_dockbook_tab_drag_begin),
-                    dockable);
-  g_signal_connect (tab_widget, "drag-end",
-                    G_CALLBACK (gimp_dockbook_tab_drag_end),
-                    dockable);
-
-  g_signal_connect (dockable, "drag-begin",
-                    G_CALLBACK (gimp_dockbook_tab_drag_begin),
-                    dockable);
-  g_signal_connect (dockable, "drag-end",
-                    G_CALLBACK (gimp_dockbook_tab_drag_end),
-                    dockable);
+  g_signal_connect_object (tab_widget, "drag-begin",
+                           G_CALLBACK (gimp_dockbook_tab_drag_begin),
+                           dockable, 0);
+  g_signal_connect_object (tab_widget, "drag-end",
+                           G_CALLBACK (gimp_dockbook_tab_drag_end),
+                           dockable, 0);
+
+  g_signal_connect_object (dockable, "drag-begin",
+                           G_CALLBACK (gimp_dockbook_tab_drag_begin),
+                           dockable, 0);
+  g_signal_connect_object (dockable, "drag-end",
+                           G_CALLBACK (gimp_dockbook_tab_drag_end),
+                           dockable, 0);
 
   gtk_drag_dest_set (tab_widget,
                      0,
                      dialog_target_table, G_N_ELEMENTS (dialog_target_table),
                      GDK_ACTION_MOVE);
-  g_signal_connect (tab_widget, "drag-leave",
-                    G_CALLBACK (gimp_dockbook_tab_drag_leave),
-                    dockable);
-  g_signal_connect (tab_widget, "drag-motion",
-                    G_CALLBACK (gimp_dockbook_tab_drag_motion),
-                    dockable);
-  g_signal_connect (tab_widget, "drag-drop",
-                    G_CALLBACK (gimp_dockbook_tab_drag_drop),
-                    dockbook);
+  g_signal_connect_object (tab_widget, "drag-leave",
+                           G_CALLBACK (gimp_dockbook_tab_drag_leave),
+                           dockable, 0);
+  g_signal_connect_object (tab_widget, "drag-motion",
+                           G_CALLBACK (gimp_dockbook_tab_drag_motion),
+                           dockable, 0);
+  g_signal_connect_object (tab_widget, "drag-drop",
+                           G_CALLBACK (gimp_dockbook_tab_drag_drop),
+                           dockbook, 0);
 
   return tab_widget;
 }



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