From 90742d7b01366418f76d7bd08b19719901997903 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 15 Mar 2022 12:14:56 +0800 Subject: [PATCH] Fix crashes when trying to pop up a menu on GTK 2 * src/xterm.c (handle_one_xevent): Respect finish when dispatching copy. --- src/xterm.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index e48592210fd..fc90e370430 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -12533,15 +12533,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (popup_activated () && xev->evtype == XI_ButtonRelease) - { - *finish = X_EVENT_DROP; - gtk_main_do_event (copy); - gdk_event_free (copy); - goto XI_OTHER; - } - - gtk_main_do_event (copy); - gdk_event_free (copy); + goto XI_OTHER; #endif #ifdef HAVE_XINPUT2_1 @@ -13717,6 +13709,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, } unblock_input (); #endif /* USE_X_TOOLKIT */ +#if defined USE_GTK && !defined HAVE_GTK3 && defined HAVE_XINPUT2 + if (*finish != X_EVENT_DROP && copy) + { + gtk_main_do_event (copy); + *finish = X_EVENT_DROP; + } + + if (copy) + gdk_event_free (copy); +#endif break; } -- 2.39.5