[gtk/wip/synthetic-motion2: 1/4] main: Avoid a crash with crossing event handling
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/synthetic-motion2: 1/4] main: Avoid a crash with crossing event handling
- Date: Wed, 26 Aug 2020 12:02:10 +0000 (UTC)
commit 864f74ff847370f23b59d8ff17ca9a5522481f87
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Aug 26 07:26:01 2020 -0400
main: Avoid a crash with crossing event handling
We are reusing the GtkCrossingData struct for multiple
calls here, so we need to make sure that the targets
stay alive from beginning to end.
gtk/gtkmain.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index a517a0e6e7..23c61cd270 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1335,9 +1335,9 @@ gtk_synthesize_crossing_events (GtkRoot *toplevel,
crossing.type = crossing_type;
crossing.mode = mode;
- crossing.old_target = old_target;
+ crossing.old_target = old_target ? g_object_ref (old_target) : NULL;
crossing.old_descendent = NULL;
- crossing.new_target = new_target;
+ crossing.new_target = new_target ? g_object_ref (new_target) : NULL;
crossing.new_descendent = NULL;
crossing.drop = drop;
@@ -1417,6 +1417,9 @@ gtk_synthesize_crossing_events (GtkRoot *toplevel,
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_PRELIGHT, FALSE);
}
+ g_clear_object (&crossing.old_target);
+ g_clear_object (&crossing.new_target);
+
gtk_widget_stack_clear (&target_array);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]