gtk: Hold reference on controller until events are fully handled

Fixes premature controller unreferencing in
gtk_event_controller_handle_event() if the controller itself is being
removed while handling the event.
This commit is contained in:
Maxim Zakharov 2021-10-27 11:37:36 +11:00
parent 4ea84d3144
commit af2d0f188c

View File

@ -367,10 +367,10 @@ gtk_event_controller_handle_event (GtkEventController *controller,
g_object_ref (controller);
retval = controller_class->handle_event (controller, event, x, y);
g_object_unref (controller);
g_clear_object (&priv->target);
g_clear_pointer (&priv->event, gdk_event_unref);
g_object_unref (controller);
return retval;
}