forked from AuroraMiddleware/gtk
eventcontroller: Ensure controllers stay alive during event emission
Those might trigger the destruction of some widget that would dispose the event controller while the event is still being handled, so keep an extra ref on the controller during event processing.
This commit is contained in:
parent
8c21b0bee5
commit
618e3d3157
@ -205,7 +205,11 @@ gtk_event_controller_handle_event (GtkEventController *controller,
|
||||
controller_class = GTK_EVENT_CONTROLLER_GET_CLASS (controller);
|
||||
|
||||
if (controller_class->handle_event)
|
||||
retval = controller_class->handle_event (controller, event);
|
||||
{
|
||||
g_object_ref (controller);
|
||||
retval = controller_class->handle_event (controller, event);
|
||||
g_object_unref (controller);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user