Fixed CGUIEditBox memory leaks and fix crash when deleting player
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9986 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c46b1de3ea
commit
62ed88eb34
@ -154,3 +154,13 @@ void TextBoxWidget::unfocused(const int playerID)
|
||||
GUIEngine::getGUIEnv()->setFocus( ModalDialog::getCurrent()->getIrrlichtElement() );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void TextBoxWidget::elementRemoved()
|
||||
{
|
||||
// normally at this point normal widgets have been deleted by irrlicht already.
|
||||
// but this is a custom widget and the gui env does not appear to want to
|
||||
// manage it. so we free it manually
|
||||
m_element->drop();
|
||||
Widget::elementRemoved();
|
||||
}
|
||||
|
@ -68,6 +68,8 @@ namespace GUIEngine
|
||||
void clearListeners();
|
||||
|
||||
irr::core::stringw getText() const;
|
||||
|
||||
virtual void elementRemoved();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,10 @@ PlayerInfoDialog::PlayerInfoDialog(PlayerProfile* player, const float w, const f
|
||||
|
||||
PlayerInfoDialog::~PlayerInfoDialog()
|
||||
{
|
||||
OptionsScreenPlayers::getInstance()->selectPlayer( translations->fribidize(m_player->getName()) );
|
||||
if (m_player != NULL)
|
||||
{
|
||||
OptionsScreenPlayers::getInstance()->selectPlayer( translations->fribidize(m_player->getName()) );
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
@ -237,7 +240,8 @@ GUIEngine::EventPropagation PlayerInfoDialog::processEvent(const std::string& ev
|
||||
else if (eventSource == "confirmremove")
|
||||
{
|
||||
OptionsScreenPlayers::getInstance()->deletePlayer( m_player );
|
||||
|
||||
m_player = NULL;
|
||||
|
||||
// irrLicht is too stupid to remove focus from deleted widgets
|
||||
// so do it by hand
|
||||
GUIEngine::getGUIEnv()->removeFocus( textCtrl->getIrrlichtElement() );
|
||||
|
Loading…
Reference in New Issue
Block a user