mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-24 00:18:07 +02:00
Fixes crash on Linux that surfaced as a result of r12493. But, this prompted
research into why that code had been ifdef'd in the first place and allowed the root cause to be identified. Now the menus are cleaned up properly, which also fixes bug #458 without having the workaround in r12639. Basically, the problem was that attempts were being made to manipulate menuitems on a menu that no longer existed (after the menus were rebuilt).
This commit is contained in:
parent
0e30a5e98c
commit
8cb1681e47
@ -1341,26 +1341,17 @@ void AudacityProject::RebuildMenuBar()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Allow FileHistory to remove its own menu
|
||||||
|
wxGetApp().GetRecentFiles()->RemoveMenu(mRecentFilesMenu);
|
||||||
|
|
||||||
// Delete the menus, since we will soon recreate them.
|
// Delete the menus, since we will soon recreate them.
|
||||||
// Rather oddly, the menus don't vanish as a result of doing this.
|
// Rather oddly, the menus don't vanish as a result of doing this.
|
||||||
wxMenuBar *menuBar = GetMenuBar();
|
wxMenuBar *menuBar = GetMenuBar();
|
||||||
DetachMenuBar();
|
DetachMenuBar();
|
||||||
delete menuBar;
|
delete menuBar;
|
||||||
|
|
||||||
/*
|
|
||||||
// msmeyer: This also makes gtk2 crash on Linux
|
|
||||||
for (int i = menuBar->GetMenuCount()-1; i >= 0; i--)
|
|
||||||
delete menuBar->Remove(i);
|
|
||||||
|
|
||||||
// msmeyer: However, this doesn't seem to matter, because CommandManager
|
|
||||||
// knows how to properly rebuild menus, even when the menu bar is already
|
|
||||||
// populated. So we just don't mess with the menus at this stage.
|
|
||||||
*/
|
|
||||||
|
|
||||||
mCommandManager.PurgeData();
|
mCommandManager.PurgeData();
|
||||||
|
|
||||||
wxGetApp().GetRecentFiles()->RemoveMenu(mRecentFilesMenu);
|
|
||||||
|
|
||||||
CreateMenusAndCommands();
|
CreateMenusAndCommands();
|
||||||
|
|
||||||
ModuleManager::Dispatch(MenusRebuilt);
|
ModuleManager::Dispatch(MenusRebuilt);
|
||||||
@ -3072,16 +3063,6 @@ void AudacityProject::OnPreferences()
|
|||||||
|
|
||||||
p->RebuildMenuBar();
|
p->RebuildMenuBar();
|
||||||
p->RebuildOtherMenus();
|
p->RebuildOtherMenus();
|
||||||
#if defined(__WXGTK__)
|
|
||||||
// Workaround for:
|
|
||||||
//
|
|
||||||
// http://bugzilla.audacityteam.org/show_bug.cgi?id=458
|
|
||||||
//
|
|
||||||
// This should be removed with wxWidgets 2.8.13 is released.
|
|
||||||
wxRect r = p->GetRect();
|
|
||||||
p->SetSize(wxSize(1,1));
|
|
||||||
p->SetSize(r.GetSize());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +165,7 @@ void CommandManager::PurgeData()
|
|||||||
mCurrentMenu = NULL;
|
mCurrentMenu = NULL;
|
||||||
mCurrentMenuName = COMMAND;
|
mCurrentMenuName = COMMAND;
|
||||||
mCurrentID = 0;
|
mCurrentID = 0;
|
||||||
|
mOpenMenu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user