emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109179: Fix data type casting when s


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109179: Fix data type casting when setting up menus on Windows.
Date: Sat, 21 Jul 2012 16:33:32 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109179
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2012-07-21 16:33:32 +0300
message:
  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 <address@hidden>.
modified:
  src/ChangeLog
  src/w32menu.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-21 12:10:49 +0000
+++ b/src/ChangeLog     2012-07-21 13:33:32 +0000
@@ -1,3 +1,9 @@
+2012-07-21  Eli Zaretskii  <address@hidden>
+
+       * w32menu.c (add_menu_item): Cast to UINT_PTR when assigning
+       info.dwItemData.  Fixes crashes on 64-bit Windows.  Suggested by
+       Fabrice Popineau <address@hidden>.
+
 2012-07-21  Jan Djärv  <address@hidden>
 
        * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134).

=== modified file 'src/w32menu.c'
--- a/src/w32menu.c     2012-07-11 07:19:44 +0000
+++ b/src/w32menu.c     2012-07-21 13:33:32 +0000
@@ -1533,7 +1533,14 @@
             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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]