emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 76233917c4: Fix freezes with some oddball menus


From: Po Lu
Subject: master 76233917c4: Fix freezes with some oddball menus
Date: Fri, 6 May 2022 21:34:54 -0400 (EDT)

branch: master
commit 76233917c47e7d4ed1d283b09ec67a8dbd6cdf4b
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/xmenu.c | 5 ++++-
 src/xterm.c | 6 +++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/xmenu.c b/src/xmenu.c
index 4c8828412d..aaf53569a7 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 6b5c272ef9..2141964c74 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]