]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix data type casting when setting up menus on Windows.
authorEli Zaretskii <eliz@gnu.org>
Sat, 21 Jul 2012 13:33:32 +0000 (16:33 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 21 Jul 2012 13:33:32 +0000 (16:33 +0300)
 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>.

src/ChangeLog
src/w32menu.c

index ed0ea6d3a176ff38a6ee4b77412f42adb85a04b0..e120edab05624850eaf299a3f1a51dba22fc8763 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-21  Eli Zaretskii  <eliz@gnu.org>
+
+       * 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>.
+
 2012-07-21  Jan Djärv  <jan.h.d@swipnet.se>
 
        * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134).
index 24dc9d79192bf683df231c3c1ec247097f6e9d82..a5f4c3881b551c59a6c21e96325d6527ca82ad48 100644 (file)
@@ -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