diff options
| author | Eli Zaretskii | 2015-01-14 20:51:33 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-01-14 20:51:33 +0200 |
| commit | e7db8e8d5de70be5e047c961cdfbf692d52e33c6 (patch) | |
| tree | 34954a9f50c315fc4f0bb90166503eba5a34d332 /src/w32menu.c | |
| parent | 9602b62514df88ddf2e9dd1451c4e7f51756d65b (diff) | |
| download | emacs-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.
Diffstat (limited to 'src/w32menu.c')
| -rw-r--r-- | src/w32menu.c | 23 |
1 files changed, 18 insertions, 5 deletions
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 | { |