diff --git a/pcsx2/gui/RecentIsoList.cpp b/pcsx2/gui/RecentIsoList.cpp index e9d8e1504a..25ad64f14b 100644 --- a/pcsx2/gui/RecentIsoList.cpp +++ b/pcsx2/gui/RecentIsoList.cpp @@ -121,7 +121,9 @@ void RecentIsoManager::Repopulate() m_Separator = m_Menu->AppendSeparator(); - for( int i=0; i=0; --i ) InsertIntoMenu( i ); } @@ -152,25 +154,19 @@ void RecentIsoManager::Add( const wxString& src ) } } - //New item doesn't exist at the menu/internal-list, add it. - + //New item doesn't exist at the menu/internal-list - add it, and refresh the menu. + RemoveAllFromMenu(); + m_Items.push_back( RecentItem( normalized ) ); - InsertIntoMenu( m_Items.size()-1 ); while( m_Items.size() > m_MaxLength ) - { //We're removing items from the internal list, need to keep the menu IDs in sync, by refreshing the menu. - //This 'while' loop typically iterates at most once. - RemoveAllFromMenu(); m_Items.erase( m_Items.begin() ); - Repopulate(); - } - //check the new (last) item - m_Items[m_Items.size()-1].ItemPtr->Check(); - m_cursel = m_Items.size()-1; + Repopulate(); + m_Items[m_cursel = m_Items.size()-1].ItemPtr->Check(); } -//id here is the position index at the list of recent ISOs +//id here is the position index at the internal list of recent ISOs (m_Items) void RecentIsoManager::InsertIntoMenu( int id ) { if( m_Menu == NULL ) return;