From 0c61827188979cce99b41fb70580b306f0955b5c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 5 Dec 2014 22:18:01 +0000 Subject: [PATCH] Remove unnecessary assert from wxMenuBar::MSWGetMenu(). This assert was triggered after the changes of the previous commit as we can get WM_MENUSELECT with menu bar handle as parameter from Windows and still search for the menu with this handle -- and there is nothing wrong with this, so just return NULL but without asserting in this case. This corrects the changes of r67355, see #13080. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/menu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 800dcdc8c9..68422010cd 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -1634,8 +1634,10 @@ void wxMenuBar::Detach() // get the menu with given handle (recursively) wxMenu* wxMenuBar::MSWGetMenu(WXHMENU hMenu) { - wxCHECK_MSG( GetHMenu() != hMenu, NULL, - wxT("wxMenuBar::MSWGetMenu(): menu handle is wxMenuBar, not wxMenu") ); + // If we're called with the handle of the menu bar itself, we can return + // immediately as it certainly can't be the handle of one of our menus. + if ( hMenu == GetHMenu() ) + return NULL; #if wxUSE_OWNER_DRAWN // query all menus