From: Po Lu Date: Sat, 7 May 2022 01:34:35 +0000 (+0800) Subject: Fix freezes with some oddball menus X-Git-Tag: emacs-29.0.90~1931^2~5 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=76233917c47e7d4ed1d283b09ec67a8dbd6cdf4b;p=emacs.git Fix freezes with some oddball menus * src/xmenu.c (x_activate_menubar): Clear flag if dispatching the event failed. * src/xterm.c (handle_one_xevent): Check for sensitive CascadeButton instead of row column type. --- diff --git a/src/xmenu.c b/src/xmenu.c index 4c8828412d3..aaf53569a72 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -677,7 +677,10 @@ x_activate_menubar (struct frame *f) } } #endif - XtDispatchEvent (f->output_data.x->saved_menu_event); + /* The cascade button might have been deleted, so don't activate the + popup if it no widget was found to dispatch to. */ + popup_activated_flag + = XtDispatchEvent (f->output_data.x->saved_menu_event); #endif unblock_input (); diff --git a/src/xterm.c b/src/xterm.c index 6b5c272ef9b..2141964c747 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -665,6 +665,7 @@ along with GNU Emacs. If not, see . */ #ifdef USE_MOTIF #include +#include #endif #ifdef USE_X_TOOLKIT @@ -16635,14 +16636,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, && event->xbutton.same_screen) { #ifdef USE_MOTIF - unsigned char column_type; Widget widget; widget = XtWindowToWidget (dpyinfo->display, event->xbutton.window); - XtVaGetValues (widget, XmNrowColumnType, &column_type, NULL); - if (column_type != XmMENU_BAR) + if (widget && XmIsCascadeButton (widget) + && XtIsSensitive (widget)) { #endif if (!f->output_data.x->saved_menu_event)