The objects-finalize test constructs gestures with NULL as
a widget. The recent addition of weak references was not
ready for that.
This commit is contained in:
Matthias Clasen 2015-03-02 20:16:25 -05:00
parent 0019eb7bf9
commit 3569d373a2
2 changed files with 6 additions and 3 deletions

View File

@ -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),

View File

@ -17196,8 +17196,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;
@ -17249,6 +17249,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);