diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 8e8d66325d..6d9c17f7a5 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -7210,6 +7210,7 @@ _gtk_widget_get_controllers_evmask (GtkWidget *widget) GList *l; priv = widget->priv; + g_object_ref (widget); for (l = priv->event_controllers; l; l = l->next) { @@ -7240,6 +7241,8 @@ _gtk_widget_run_controllers (GtkWidget *widget, handled |= gtk_event_controller_handle_event (data->controller, event); } + g_object_unref (widget); + return handled; }