From 9280f836c2569d0f50301a1117f7ba144e5240d2 Mon Sep 17 00:00:00 2001 From: Tim Kosse Date: Sun, 15 Jun 2014 22:17:39 +0000 Subject: [PATCH] Under certain conditions, selecting a menu item triggers an assert in toplevel.cpp:1539: wxASSERT_MSG( m_menuDepth > 0, wxS("No open menus?") ); The conditions to reproduce: - Windows 8.1 - An application manifest that indicates Windows 8.1 compatibility In this case, wxGetWinVersion() used to return wxWinVersion_Unknown (Without a manifest indicating 8.1 support, wxWinVersion_8 is being returned). This in turn causes the version check against Windows98 in toplevel.cpp:450 to fail, ultimately leading to the mentioned assert. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms724439%28v=vs.85%29.aspx for details. This patch on trunk adjusts adds the wxWinVersion_8_1 enum value and returns it on Windows 8.1 if the program is manifested as such. In future, a different approach needs to be chosen that does not depend the deprecated GetVersion function. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76714 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/private.h | 6 ++++-- src/msw/utils.cpp | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 6cd7fc0328..abba5ac998 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -920,7 +920,8 @@ inline wxString wxGetFullModuleName() // 0x0502 Windows XP SP2, 2003 SP1 // 0x0600 Windows Vista, 2008 // 0x0601 Windows 7 -// 0x0602 Windows 8 (currently also returned for 8.1) +// 0x0602 Windows 8 (currently also returned for 8.1 if program does not have a manifest indicating 8.1 support) +// 0x0603 Windows 8.1 (currently only returned for 8.1 if program has a manifest indicating 8.1 support) // // for the other Windows versions 0 is currently returned enum wxWinVersion @@ -950,7 +951,8 @@ enum wxWinVersion wxWinVersion_7 = 0x601, - wxWinVersion_8 = 0x602 + wxWinVersion_8 = 0x602, + wxWinVersion_8_1 = 0x603 }; WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion(); diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 71f8cae2a4..49ded076cc 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -1361,6 +1361,9 @@ wxWinVersion wxGetWinVersion() case 2: return wxWinVersion_8; + + case 3: + return wxWinVersion_8_1; } break; }