Don't set invoking window recursively in wxGTK wxWindow::PopupMenu().

Setting the invoking window for all submenus is unnecessary as
wxMenu::GetWindow() recurses upwards anyhow and results in assert failures
after recent menu code changes.

Simply don't do this.

OTOH do reset the invoking window to NULL after the menu is dismissed to avoid
storing a dangling pointer in the menu.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2010-04-26 14:19:10 +00:00
parent b1153ed60f
commit 6de0a414a5

View File

@ -3970,23 +3970,6 @@ bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style)
#if wxUSE_MENUS_NATIVE
static void SetInvokingWindow( wxMenu *menu, wxWindow* win )
{
menu->SetInvokingWindow( win );
wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *menuitem = node->GetData();
if (menuitem->IsSubMenu())
{
SetInvokingWindow( menuitem->GetSubMenu(), win );
}
node = node->GetNext();
}
}
extern "C" {
static
void wxPopupMenuPositionCallback( GtkMenu *menu,
@ -4015,7 +3998,7 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
wxCHECK_MSG( menu != NULL, false, wxT("invalid popup-menu") );
SetInvokingWindow( menu, this );
menu->SetInvokingWindow( this );
menu->UpdateUI();
@ -4051,6 +4034,8 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
gtk_main_iteration();
}
menu->SetInvokingWindow( NULL );
return true;
}