[gtk/matthiasc/for-master: 1/2] widget: Avoid a crash in crossing event handling
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 1/2] widget: Avoid a crash in crossing event handling
- Date: Wed, 26 Aug 2020 11:28:13 +0000 (UTC)
commit 44741e1b7730ab6a52dbd979901768d6e7eb33c7
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Aug 26 07:24:54 2020 -0400
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.
gtk/gtkwidget.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 9f538f42ea..e8106fca84 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]