From: Vadim Zeitlin Date: Wed, 29 Oct 2008 16:04:06 +0000 (+0000) Subject: fix assert when adding an entry to an already full file history (closes #10118) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/838dd956a4049c7c95f015ee6b79d3bcf2ec9d6e 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 --- diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 3498256d94..db67b46123 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -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++;