]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix crashes when trying to pop up a menu on GTK 2
authorPo Lu <luangruo@yahoo.com>
Tue, 15 Mar 2022 04:14:56 +0000 (12:14 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 15 Mar 2022 04:14:56 +0000 (12:14 +0800)
* src/xterm.c (handle_one_xevent): Respect finish when
dispatching copy.

src/xterm.c

index e48592210fd45fb562e2f02e76a11daa9e2149bf..fc90e370430d3f13f43ab36f9b38087ea897732d 100644 (file)
@@ -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;
     }