forked from AuroraMiddleware/gtk
widget: Keep a widget reference around _gtk_widget_run_controllers()
The widget may be destroyed within the loop, in reaction to the signals sent by the controllers. Protect against that.
This commit is contained in:
parent
db55f8a4e5
commit
f0940c962f
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user