From a8771e86ad7120ee532436ac40b4177366d37c68 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Tue, 4 Sep 2012 00:40:47 -0300 Subject: [PATCH] Fix bug when closing character list --- modules/client_entergame/characterlist.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/client_entergame/characterlist.lua b/modules/client_entergame/characterlist.lua index 777812e5..b9762023 100644 --- a/modules/client_entergame/characterlist.lua +++ b/modules/client_entergame/characterlist.lua @@ -138,7 +138,12 @@ function CharacterList.terminate() disconnect(g_game, { onGameStart = CharacterList.destroyLoadBox }) disconnect(g_game, { onLoginWait = onLoginWait }) disconnect(g_game, { onGameEnd = CharacterList.showAgain }) - CharacterList.destroy() + + if charactersWindow then + characterList = nil + charactersWindow:destroy() + charactersWindow = nil + end if loadBox then g_game.cancelLogin() @@ -166,6 +171,10 @@ end function CharacterList.create(characters, account, otui) if not otui then otui = 'characterlist.otui' end + + if charactersWindow then + charactersWindow:destroy() + end charactersWindow = g_ui.displayUI(otui) characterList = charactersWindow:getChildById('characters') @@ -220,6 +229,8 @@ function CharacterList.create(characters, account, otui) end function CharacterList.destroy() + charactersWindow:hide() + if charactersWindow then characterList = nil charactersWindow:destroy() @@ -262,7 +273,7 @@ function CharacterList.doLogin() local charInfo = { worldHost = selected.worldHost, worldPort = selected.worldPort, characterName = selected.characterName } - CharacterList.hide() + charactersWindow:hide() tryLogin(charInfo) else displayErrorBox(tr('Error'), tr('You must select a character to login!'))