diff options
Diffstat (limited to 'gtk/gtkeventcontroller.c')
-rw-r--r-- | gtk/gtkeventcontroller.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gtk/gtkeventcontroller.c b/gtk/gtkeventcontroller.c index ba3c7c6d1d..b674380e19 100644 --- a/gtk/gtkeventcontroller.c +++ b/gtk/gtkeventcontroller.c @@ -115,8 +115,8 @@ gtk_event_controller_constructed (GObject *object) GtkEventControllerPrivate *priv; priv = gtk_event_controller_get_instance_private (controller); - g_assert (priv->widget != NULL); - _gtk_widget_add_controller (priv->widget, controller); + if (priv->widget) + _gtk_widget_add_controller (priv->widget, controller); } static void @@ -126,7 +126,8 @@ gtk_event_controller_dispose (GObject *object) GtkEventControllerPrivate *priv; priv = gtk_event_controller_get_instance_private (controller); - _gtk_widget_remove_controller (priv->widget, controller); + if (priv->widget) + _gtk_widget_remove_controller (priv->widget, controller); } static void |