mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 15:14:17 +00:00
widget: Avoid a crash in crossing event handling
We need to make sure that the crossing data stays alive until we are done handling it, so take references on all the widgets in it.
This commit is contained in:
parent
eef1818cee
commit
44741e1b77
@ -4376,12 +4376,30 @@ gtk_widget_handle_crossing (GtkWidget *widget,
|
||||
|
||||
g_object_ref (widget);
|
||||
|
||||
if (crossing->old_target)
|
||||
g_object_ref (crossing->old_target);
|
||||
if (crossing->new_target)
|
||||
g_object_ref (crossing->new_target);
|
||||
if (crossing->old_descendent)
|
||||
g_object_ref (crossing->old_descendent);
|
||||
if (crossing->new_descendent)
|
||||
g_object_ref (crossing->new_descendent);
|
||||
|
||||
for (l = priv->event_controllers; l; l = l->next)
|
||||
{
|
||||
GtkEventController *controller = l->data;
|
||||
gtk_event_controller_handle_crossing (controller, crossing, x, y);
|
||||
}
|
||||
|
||||
if (crossing->old_target)
|
||||
g_object_unref (crossing->old_target);
|
||||
if (crossing->new_target)
|
||||
g_object_unref (crossing->new_target);
|
||||
if (crossing->old_descendent)
|
||||
g_object_unref (crossing->old_descendent);
|
||||
if (crossing->new_descendent)
|
||||
g_object_unref (crossing->new_descendent);
|
||||
|
||||
g_object_unref (widget);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user