From 00e6d8ab78e9ccc985afc6551a179f58967ef6bd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 6 Feb 2001 00:14:27 +0000 Subject: [PATCH] applied patch 103610 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/docview.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/common/docview.cpp b/src/common/docview.cpp index b745d1f..7a97237 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -2162,11 +2162,6 @@ void wxFileHistory::RemoveFileFromHistory(int i) wxCHECK_RET( i < m_fileHistoryN, wxT("invalid index in wxFileHistory::RemoveFileFromHistory") ); - wxNode* node = m_fileMenus.First(); - while ( node ) - { - wxMenu* menu = (wxMenu*) node->Data(); - // delete the element from the array (could use memmove() too...) delete [] m_fileHistory[i]; @@ -2176,6 +2171,12 @@ void wxFileHistory::RemoveFileFromHistory(int i) m_fileHistory[j] = m_fileHistory[j + 1]; } + wxNode* node = m_fileMenus.First(); + while ( node ) + { + wxMenu* menu = (wxMenu*) node->Data(); + + // shuffle filenames up wxString buf; for ( j = i; j < m_fileHistoryN - 1; j++ ) @@ -2187,6 +2188,7 @@ void wxFileHistory::RemoveFileFromHistory(int i) node = node->Next(); // delete the last menu item which is unused now + if (menu->FindItem(wxID_FILE1 + m_fileHistoryN - 1)) menu->Delete(wxID_FILE1 + m_fileHistoryN - 1); // delete the last separator too if no more files are left -- 2.7.4