From: Eli Zaretskii Date: Sat, 21 Jul 2012 13:33:32 +0000 (+0300) Subject: Fix data type casting when setting up menus on Windows. X-Git-Tag: emacs-24.2.90~1109 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2d5c5f7da98d15665efe83a078dbb45520d003af;p=emacs.git 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 . --- diff --git a/src/ChangeLog b/src/ChangeLog index ed0ea6d3a17..e120edab056 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-07-21 Eli Zaretskii + + * w32menu.c (add_menu_item): Cast to UINT_PTR when assigning + info.dwItemData. Fixes crashes on 64-bit Windows. Suggested by + Fabrice Popineau . + 2012-07-21 Jan Djärv * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134). 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