[gimp] app: set GimpContainerTreeView->dnd_renderer to NULL more reliably



commit 27a767ee5499f862d481fb4c49bb51041b8325ad
Author: Michael Natterer <mitch gimp org>
Date:   Tue May 22 12:58:10 2012 +0200

    app: set GimpContainerTreeView->dnd_renderer to NULL more reliably
    
    specifically in button_release() and when the container changes, we
    can badly crash in some situations otherwise.

 app/widgets/gimpcontainertreeview.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c
index f51ee45..d0329bb 100644
--- a/app/widgets/gimpcontainertreeview.c
+++ b/app/widgets/gimpcontainertreeview.c
@@ -103,6 +103,9 @@ static void          gimp_container_tree_view_selection_changed (GtkTreeSelectio
 static gboolean      gimp_container_tree_view_button_press      (GtkWidget                   *widget,
                                                                  GdkEventButton              *bevent,
                                                                  GimpContainerTreeView       *tree_view);
+static gboolean      gimp_container_tree_view_button_release    (GtkWidget                   *widget,
+                                                                 GdkEventButton              *bevent,
+                                                                 GimpContainerTreeView       *tree_view);
 static gboolean      gimp_container_tree_view_tooltip           (GtkWidget                   *widget,
                                                                  gint                         x,
                                                                  gint                         y,
@@ -523,6 +526,8 @@ gimp_container_tree_view_set_container (GimpContainerView *view,
 
   if (old_container)
     {
+      tree_view->priv->dnd_renderer = NULL;
+
       g_signal_handlers_disconnect_by_func (tree_view->view,
                                             gimp_container_tree_view_row_expanded,
                                             tree_view);
@@ -540,6 +545,9 @@ gimp_container_tree_view_set_container (GimpContainerView *view,
           g_signal_handlers_disconnect_by_func (tree_view->view,
                                                 gimp_container_tree_view_button_press,
                                                 tree_view);
+          g_signal_handlers_disconnect_by_func (tree_view->view,
+                                                gimp_container_tree_view_button_release,
+                                                tree_view);
         }
     }
   else if (container)
@@ -566,6 +574,9 @@ gimp_container_tree_view_set_container (GimpContainerView *view,
       g_signal_connect (tree_view->view, "button-press-event",
                         G_CALLBACK (gimp_container_tree_view_button_press),
                         tree_view);
+      g_signal_connect (tree_view->view, "button-release-event",
+                        G_CALLBACK (gimp_container_tree_view_button_release),
+                        tree_view);
     }
 
   parent_view_iface->set_container (view, container);
@@ -1181,6 +1192,16 @@ gimp_container_tree_view_button_press (GtkWidget             *widget,
 }
 
 static gboolean
+gimp_container_tree_view_button_release (GtkWidget             *widget,
+                                         GdkEventButton        *bevent,
+                                         GimpContainerTreeView *tree_view)
+{
+  tree_view->priv->dnd_renderer = NULL;
+
+  return FALSE;
+}
+
+static gboolean
 gimp_container_tree_view_tooltip (GtkWidget             *widget,
                                   gint                   x,
                                   gint                   y,



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