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:
Carlos Garnacho 2014-05-28 19:39:07 +02:00
parent 8c21b0bee5
commit 618e3d3157

View File

@ -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;
}