fix assert when adding an entry to an already full file history (closes #10118)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-10-29 16:04:06 +00:00
parent 5e27edecac
commit 838dd956a4

View File

@@ -2013,24 +2013,22 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
{
RemoveFileFromHistory(--numFiles);
}
else // add a new menu item to all file menus (will be updated below)
// add a new menu item to all file menus (they will be updated below)
for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
node;
node = node->GetNext() )
{
for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst();
node;
node = node->GetNext() )
{
wxMenu * const menu = (wxMenu *)node->GetData();
wxMenu * const menu = (wxMenu *)node->GetData();
if ( !numFiles && menu->GetMenuItemCount() )
menu->AppendSeparator();
if ( !numFiles && menu->GetMenuItemCount() )
menu->AppendSeparator();
// label doesn't matter, it will be set below anyhow, but it can't
// be empty (this is supposed to indicate a stock item)
menu->Append(m_idBase + numFiles, " ");
}
// label doesn't matter, it will be set below anyhow, but it can't
// be empty (this is supposed to indicate a stock item)
menu->Append(m_idBase + numFiles, " ");
}
// insert the new file in the beginning of the file history
m_fileHistory.insert(m_fileHistory.begin(), file);
numFiles++;