emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master e7db8e8: Fix crashes on MS-Windows due to pop-up me


From: Eli Zaretskii
Subject: [Emacs-diffs] master e7db8e8: Fix crashes on MS-Windows due to pop-up menus (Bug#19596)
Date: Wed, 14 Jan 2015 18:53:21 +0000

branch: master
commit e7db8e8d5de70be5e047c961cdfbf692d52e33c6
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix crashes on MS-Windows due to pop-up menus  (Bug#19596)
    
     src/w32fns.c (w32_wnd_proc): Ignore MENUITEMINFO's dwItemData data
     when FLAGS indicate the item is not highlighted, i.e. it's not our
     help-echo string.
---
 src/ChangeLog |    5 +++++
 src/w32menu.c |   23 ++++++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index be2e89f..b2588f1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-14  Eli Zaretskii  <address@hidden>
+
+       * w32fns.c (w32_wnd_proc): Ignore MENUITEMINFO's dwItemData data
+       when FLAGS indicate the item is not highlighted.  (Bug#19596)
+
 2015-01-14  Martin Rudalics  <address@hidden>
 
        * xmenu.c (update_frame_menubar): Remove garbaged code.
diff --git a/src/w32menu.c b/src/w32menu.c
index 2742276..2a1dafb 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1476,11 +1476,24 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT 
item, UINT flags)
       struct frame *f = x_window_to_frame (&one_w32_display_info, owner);
       Lisp_Object frame, help;
 
-      /* No help echo on owner-draw menu items, or when the keyboard is used
-        to navigate the menus, since tooltips are distracting if they pop
-        up elsewhere.  */
-      if (flags & MF_OWNERDRAW || flags & MF_POPUP
-         || !(flags & MF_MOUSESELECT))
+      /* No help echo on owner-draw menu items, or when the keyboard
+        is used to navigate the menus, since tooltips are distracting
+        if they pop up elsewhere.  */
+      if ((flags & MF_OWNERDRAW) || (flags & MF_POPUP)
+         || !(flags & MF_MOUSESELECT)
+         /* Ignore any dwItemData for menu items whose flags don't
+            have the MF_HILITE bit set.  These are dwItemData that
+            Windows sends our way, but they aren't pointers to our
+            Lisp_String objects, so trying to create Lisp_Strings out
+            of them below and pass that to the keyboard queue will
+            crash Emacs when we try to display those "strings".  It
+            is unclear why we get these dwItemData, or what they are:
+            sometimes they point to a wchar_t string that is the menu
+            title, sometimes to someting that doesn't look like text
+            at all.  (The problematic data also comes with the 0x0800
+            bit set, but this bit is not documented, so we don't want
+            to depend on it.)  */
+         || !(flags & MF_HILITE))
        help = Qnil;
       else
        {



reply via email to

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