Fixed bug that could occur when leaving kart selection screen and a kart is currently leaving but not yet gone

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6146 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-09-25 20:12:54 +00:00
parent 984030f990
commit d62e1f659d

View File

@ -943,6 +943,14 @@ void KartSelectionScreen::init()
void KartSelectionScreen::tearDown()
{
// if a removed widget is currently shrinking down, remove it upon leaving the screen
if (m_removed_widget != NULL)
{
manualRemoveWidget(m_removed_widget);
delete m_removed_widget;
m_removed_widget = NULL;
}
Screen::tearDown();
m_kart_widgets.clearAndDeleteAll();
} // tearDown
@ -1094,6 +1102,15 @@ bool KartSelectionScreen::playerQuit(StateManager::ActivePlayer* player)
// unset selection of this player
GUIEngine::focusNothingForPlayer(playerID);
// delete a previous removed widget that didn't have time to fully shrink yet
// FIXME: handle multiple shrinking widgets gracefully?
if (m_removed_widget != NULL)
{
manualRemoveWidget(m_removed_widget);
delete m_removed_widget;
m_removed_widget = NULL;
}
// keep the removed kart a while, for the 'disappear' animation to take place
m_removed_widget = m_kart_widgets.remove(playerID);