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
This commit is contained in:
Tim Kosse 2014-06-15 22:17:39 +00:00
parent 56b49d5bd3
commit 9280f836c2
2 changed files with 7 additions and 2 deletions

View File

@ -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();

View File

@ -1361,6 +1361,9 @@ wxWinVersion wxGetWinVersion()
case 2:
return wxWinVersion_8;
case 3:
return wxWinVersion_8_1;
}
break;
}