aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-01-14 20:51:33 +0200
committerEli Zaretskii2015-01-14 20:51:33 +0200
commite7db8e8d5de70be5e047c961cdfbf692d52e33c6 (patch)
tree34954a9f50c315fc4f0bb90166503eba5a34d332
parent9602b62514df88ddf2e9dd1451c4e7f51756d65b (diff)
downloademacs-e7db8e8d5de70be5e047c961cdfbf692d52e33c6.tar.gz
emacs-e7db8e8d5de70be5e047c961cdfbf692d52e33c6.zip
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.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/w32menu.c23
2 files changed, 23 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index be2e89fedbf..b2588f1451f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12015-01-14 Eli Zaretskii <eliz@gnu.org>
2
3 * w32fns.c (w32_wnd_proc): Ignore MENUITEMINFO's dwItemData data
4 when FLAGS indicate the item is not highlighted. (Bug#19596)
5
12015-01-14 Martin Rudalics <rudalics@gmx.at> 62015-01-14 Martin Rudalics <rudalics@gmx.at>
2 7
3 * xmenu.c (update_frame_menubar): Remove garbaged code. 8 * xmenu.c (update_frame_menubar): Remove garbaged code.
diff --git a/src/w32menu.c b/src/w32menu.c
index 2742276d3f6..2a1dafbd6d7 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)
1476 struct frame *f = x_window_to_frame (&one_w32_display_info, owner); 1476 struct frame *f = x_window_to_frame (&one_w32_display_info, owner);
1477 Lisp_Object frame, help; 1477 Lisp_Object frame, help;
1478 1478
1479 /* No help echo on owner-draw menu items, or when the keyboard is used 1479 /* No help echo on owner-draw menu items, or when the keyboard
1480 to navigate the menus, since tooltips are distracting if they pop 1480 is used to navigate the menus, since tooltips are distracting
1481 up elsewhere. */ 1481 if they pop up elsewhere. */
1482 if (flags & MF_OWNERDRAW || flags & MF_POPUP 1482 if ((flags & MF_OWNERDRAW) || (flags & MF_POPUP)
1483 || !(flags & MF_MOUSESELECT)) 1483 || !(flags & MF_MOUSESELECT)
1484 /* Ignore any dwItemData for menu items whose flags don't
1485 have the MF_HILITE bit set. These are dwItemData that
1486 Windows sends our way, but they aren't pointers to our
1487 Lisp_String objects, so trying to create Lisp_Strings out
1488 of them below and pass that to the keyboard queue will
1489 crash Emacs when we try to display those "strings". It
1490 is unclear why we get these dwItemData, or what they are:
1491 sometimes they point to a wchar_t string that is the menu
1492 title, sometimes to someting that doesn't look like text
1493 at all. (The problematic data also comes with the 0x0800
1494 bit set, but this bit is not documented, so we don't want
1495 to depend on it.) */
1496 || !(flags & MF_HILITE))
1484 help = Qnil; 1497 help = Qnil;
1485 else 1498 else
1486 { 1499 {