aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32menu.c
diff options
context:
space:
mode:
authorEli Zaretskii2012-07-21 16:33:32 +0300
committerEli Zaretskii2012-07-21 16:33:32 +0300
commit2d5c5f7da98d15665efe83a078dbb45520d003af (patch)
treea313da92a8af7ee37509355e21b72b8ea767c466 /src/w32menu.c
parent784051c42a953356befde5e9fa4a98b433b55a7c (diff)
downloademacs-2d5c5f7da98d15665efe83a078dbb45520d003af.tar.gz
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.c9
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)
1533 until it is ready to be displayed, since GC can happen while 1533 until it is ready to be displayed, since GC can happen while
1534 menus are active. */ 1534 menus are active. */
1535 if (!NILP (wv->help)) 1535 if (!NILP (wv->help))
1536 info.dwItemData = (DWORD) XLI (wv->help); 1536 {
1537 /* As of Jul-2012, w32api headers say that dwItemData
1538 has DWORD type, but that's a bug: it should actually
1539 be UINT_PTR, which is correct for 32-bit and 64-bit
1540 Windows alike. MSVC headers get it right; hopefully,
1541 MinGW headers will, too. */
1542 info.dwItemData = (UINT_PTR) XLI (wv->help);
1543 }
1537 if (wv->button_type == BUTTON_TYPE_RADIO) 1544 if (wv->button_type == BUTTON_TYPE_RADIO)
1538 { 1545 {
1539 /* CheckMenuRadioItem allows us to differentiate TOGGLE and 1546 /* CheckMenuRadioItem allows us to differentiate TOGGLE and