]> git.saurik.com Git - wxWidgets.git/commitdiff
fix assert when adding an entry to an already full file history (closes #10118)
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 29 Oct 2008 16:04:06 +0000 (16:04 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 29 Oct 2008 16:04:06 +0000 (16:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/docview.cpp

index 3498256d9480df39b18fbfdaee73dd55118b01dd..db67b4612334fe1f7d491e095125b2a5a2d43579 100644 (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++;