Recent ISO list menu: Fixed: if the number of ISOs grow beyond RecentIsoCount, the menu gets b0rked (broken behavior). Strangely, this bug was there since r3878 or earlier...

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4523 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
avihal@gmail.com 2011-04-02 07:26:12 +00:00
parent d30a2dbd10
commit f76e0e1d0d
1 changed files with 11 additions and 2 deletions

View File

@ -152,13 +152,22 @@ void RecentIsoManager::Add( const wxString& src )
} }
} }
//New item doesn't exist at the menu/internal-list, add it.
m_Items.push_back( RecentItem( normalized ) ); m_Items.push_back( RecentItem( normalized ) );
InsertIntoMenu( m_cursel = (m_Items.size()-1) ); InsertIntoMenu( m_Items.size()-1 );
while( m_Items.size() > m_MaxLength ) 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() ); 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;
} }
//id here is the position index at the list of recent ISOs //id here is the position index at the list of recent ISOs