diff options
author | Eli Zaretskii <eliz@gnu.org> | 2012-07-21 16:33:32 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2012-07-21 16:33:32 +0300 |
commit | 2d5c5f7da98d15665efe83a078dbb45520d003af (patch) | |
tree | a313da92a8af7ee37509355e21b72b8ea767c466 /src/w32menu.c | |
parent | 784051c42a953356befde5e9fa4a98b433b55a7c (diff) | |
download | emacs-2d5c5f7da98d15665efe83a078dbb45520d003af.tar.gz emacs-2d5c5f7da98d15665efe83a078dbb45520d003af.tar.bz2 emacs-2d5c5f7da98d15665efe83a078dbb45520d003af.zip |
Fix data type casting when setting up menus on Windows.
src/w32menu.c (add_menu_item): Cast to UINT_PTR when assigning
info.dwItemData. Fixes crashes on 64-bit Windows. Suggested by
Fabrice Popineau <fabrice.popineau@supelec.fr>.
Diffstat (limited to 'src/w32menu.c')
-rw-r--r-- | src/w32menu.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/w32menu.c b/src/w32menu.c index 24dc9d79192..a5f4c3881b5 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -1533,7 +1533,14 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) until it is ready to be displayed, since GC can happen while menus are active. */ if (!NILP (wv->help)) - info.dwItemData = (DWORD) XLI (wv->help); + { + /* As of Jul-2012, w32api headers say that dwItemData + has DWORD type, but that's a bug: it should actually + be UINT_PTR, which is correct for 32-bit and 64-bit + Windows alike. MSVC headers get it right; hopefully, + MinGW headers will, too. */ + info.dwItemData = (UINT_PTR) XLI (wv->help); + } if (wv->button_type == BUTTON_TYPE_RADIO) { /* CheckMenuRadioItem allows us to differentiate TOGGLE and |