[gtk+/gtk-3-14] Fix 7c4bf742e82d812ecc5b0c3280db86d2689eb093



commit 9813971304d2635851659d98168c655227f95d9e
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Mar 2 20:16:25 2015 -0500

    Fix 7c4bf742e82d812ecc5b0c3280db86d2689eb093
    
    The objects-finalize test constructs gestures with NULL as
    a widget. The recent addition of weak references was not
    ready for that.

 gtk/gtkeventcontroller.c |    3 ++-
 gtk/gtkwidget.c          |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkeventcontroller.c b/gtk/gtkeventcontroller.c
index 0b932ab..4a3e301 100644
--- a/gtk/gtkeventcontroller.c
+++ b/gtk/gtkeventcontroller.c
@@ -75,7 +75,8 @@ gtk_event_controller_set_property (GObject      *object,
     {
     case PROP_WIDGET:
       priv->widget = g_value_get_object (value);
-      g_object_add_weak_pointer (G_OBJECT (priv->widget), (gpointer *) &priv->widget);
+      if (priv->widget)
+        g_object_add_weak_pointer (G_OBJECT (priv->widget), (gpointer *) &priv->widget);
       break;
     case PROP_PROPAGATION_PHASE:
       gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (object),
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 9200107..11df1e8 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -17077,8 +17077,8 @@ _gtk_widget_has_controller (GtkWidget          *widget,
 }
 
 void
-_gtk_widget_add_controller (GtkWidget           *widget,
-                            GtkEventController  *controller)
+_gtk_widget_add_controller (GtkWidget          *widget,
+                            GtkEventController *controller)
 {
   EventControllerData *data;
   GtkWidgetPrivate *priv;
@@ -17130,6 +17130,8 @@ _gtk_widget_remove_controller (GtkWidget          *widget,
   if (!data)
     return;
 
+  g_object_remove_weak_pointer (G_OBJECT (data->controller), (gpointer *) &data->controller);
+
   if (g_signal_handler_is_connected (widget, data->grab_notify_id))
     g_signal_handler_disconnect (widget, data->grab_notify_id);
 


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