]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix freezes with some oddball menus
authorPo Lu <luangruo@yahoo.com>
Sat, 7 May 2022 01:34:35 +0000 (09:34 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 7 May 2022 01:34:35 +0000 (09:34 +0800)
* 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.

src/xmenu.c
src/xterm.c

index 4c8828412d3ba7f52c64188ce6b8034eca2e76d3..aaf53569a72783d6b52eeb8388ee993e7caccf36 100644 (file)
@@ -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 ();
 
index 6b5c272ef9b1b4beb1a888f9194bee383b0827a7..2141964c7472d5ded3c52be0b505553bdeb67ad6 100644 (file)
@@ -665,6 +665,7 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 
 #ifdef USE_MOTIF
 #include <Xm/Xm.h>
+#include <Xm/CascadeB.h>
 #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)