From 8ce01084afea49c8aaacf9bd052c969d974ab81b Mon Sep 17 00:00:00 2001 From: Peter Bloomfield Date: Fri, 7 Dec 2018 19:18:35 -0500 Subject: [PATCH 1/2] gtkmain: Avoid critical messages on closing window Do not call _gtk_widget_captured_event(), in propagate_event_down(), or gtk_widget_event(), in propagate_event_up(), when the widget has been unrealized. --- gtk/gtkmain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index eff0d62ed3..ecd9f44781 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -2436,7 +2436,7 @@ propagate_event_up (GtkWidget *widget, */ if (!gtk_widget_is_sensitive (widget)) handled_event = event->any.type != GDK_SCROLL; - else + else if (gtk_widget_get_realized (widget)) handled_event = gtk_widget_event (widget, event); tmp = gtk_widget_get_parent (widget); @@ -2490,7 +2490,7 @@ propagate_event_down (GtkWidget *widget, else handled_event = TRUE; } - else + else if (gtk_widget_get_realized (widget)) handled_event = _gtk_widget_captured_event (widget, event); } g_list_free_full (widgets, (GDestroyNotify)g_object_unref); From 8a27302d56e4fb271103627d380499781b3e14ed Mon Sep 17 00:00:00 2001 From: Peter Bloomfield Date: Mon, 17 Dec 2018 12:04:10 -0500 Subject: [PATCH 2/2] gtkmain: Terminate two loops early In propagate_event_{down,up}(), set handled_event to TRUE if a widget is unrealized, so as to terminate the corresponding loop early. See https://gitlab.gnome.org/GNOME/gtk/merge_requests/442 --- gtk/gtkmain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index ecd9f44781..35a5e77003 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -2439,6 +2439,8 @@ propagate_event_up (GtkWidget *widget, else if (gtk_widget_get_realized (widget)) handled_event = gtk_widget_event (widget, event); + handled_event |= !gtk_widget_get_realized (widget); + tmp = gtk_widget_get_parent (widget); g_object_unref (widget); @@ -2492,6 +2494,8 @@ propagate_event_down (GtkWidget *widget, } else if (gtk_widget_get_realized (widget)) handled_event = _gtk_widget_captured_event (widget, event); + + handled_event |= !gtk_widget_get_realized (widget); } g_list_free_full (widgets, (GDestroyNotify)g_object_unref);