fixed crash with ownerdrawn menu items accelerators (Perry Miller)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36863 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -57,6 +57,7 @@ All (GUI):
|
|||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
|
||||||
|
- Fixed crash with ownerdrawn menu items accelerators (Perry Miller)
|
||||||
- wxFileDialog respects absence of wxCHANGE_DIR flag under NT (Brad Anderson).
|
- wxFileDialog respects absence of wxCHANGE_DIR flag under NT (Brad Anderson).
|
||||||
- Switching page of a hidden notebook doesn't lose focus (Jamie Gadd).
|
- Switching page of a hidden notebook doesn't lose focus (Jamie Gadd).
|
||||||
- Removed wxImageList *GetImageList(int) const.
|
- Removed wxImageList *GetImageList(int) const.
|
||||||
|
@@ -4893,12 +4893,20 @@ int wxWindowMSW::HandleMenuChar(int WXUNUSED_IN_WINCE(chAccel),
|
|||||||
MENUITEMINFO mii;
|
MENUITEMINFO mii;
|
||||||
wxZeroMemory(mii);
|
wxZeroMemory(mii);
|
||||||
mii.cbSize = sizeof(MENUITEMINFO);
|
mii.cbSize = sizeof(MENUITEMINFO);
|
||||||
|
|
||||||
|
// we could use MIIM_FTYPE here as we only need to know if the item is
|
||||||
|
// ownerdrawn or not and not dwTypeData which MIIM_TYPE also returns, but
|
||||||
|
// MIIM_FTYPE is not supported under Win95
|
||||||
mii.fMask = MIIM_TYPE | MIIM_DATA;
|
mii.fMask = MIIM_TYPE | MIIM_DATA;
|
||||||
|
|
||||||
// find if we have this letter in any owner drawn item
|
// find if we have this letter in any owner drawn item
|
||||||
const int count = ::GetMenuItemCount(hmenu);
|
const int count = ::GetMenuItemCount(hmenu);
|
||||||
for ( int i = 0; i < count; i++ )
|
for ( int i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
|
// previous loop iteration could modify it, reset it back before
|
||||||
|
// calling GetMenuItemInfo() to prevent it from overflowing dwTypeData
|
||||||
|
mii.cch = 0;
|
||||||
|
|
||||||
if ( ::GetMenuItemInfo(hmenu, i, TRUE, &mii) )
|
if ( ::GetMenuItemInfo(hmenu, i, TRUE, &mii) )
|
||||||
{
|
{
|
||||||
if ( mii.fType == MFT_OWNERDRAW )
|
if ( mii.fType == MFT_OWNERDRAW )
|
||||||
@@ -4936,8 +4944,7 @@ int wxWindowMSW::HandleMenuChar(int WXUNUSED_IN_WINCE(chAccel),
|
|||||||
}
|
}
|
||||||
else // failed to get the menu text?
|
else // failed to get the menu text?
|
||||||
{
|
{
|
||||||
// it's not fatal, so don't show error, but still log
|
// it's not fatal, so don't show error, but still log it
|
||||||
// it
|
|
||||||
wxLogLastError(_T("GetMenuItemInfo"));
|
wxLogLastError(_T("GetMenuItemInfo"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user