diff --git a/src/states_screens/kart_selection.cpp b/src/states_screens/kart_selection.cpp index 174d05886..86537f05f 100644 --- a/src/states_screens/kart_selection.cpp +++ b/src/states_screens/kart_selection.cpp @@ -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);