From 1c9df7b5139f80a85333f9ab88a9500381be1690 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 15 Jan 2014 01:30:24 +0300 Subject: Fix unloading mods setting tab if change character or network error. --- src/gui/windows/setup.cpp | 18 ++++++++++++------ src/gui/windows/setup.h | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gui/windows/setup.cpp b/src/gui/windows/setup.cpp index 5ba27f23c..d0ecc2d6d 100644 --- a/src/gui/windows/setup.cpp +++ b/src/gui/windows/setup.cpp @@ -203,6 +203,7 @@ void Setup::setInGame(const bool inGame) void Setup::externalUpdate() { + unloadModTab(); mModsTab = new Setup_Mods(this); mTabs.push_back(mModsTab); mPanel->addTab(mModsTab->getName(), mModsTab); @@ -213,13 +214,8 @@ void Setup::externalUpdate() } } -void Setup::externalUnload() +void Setup::unloadModTab() { - FOR_EACH (std::list::const_iterator, it, mTabs) - { - if (*it) - (*it)->externalUnloaded(); - } if (mModsTab) { mTabs.remove(mModsTab); @@ -230,6 +226,16 @@ void Setup::externalUnload() } } +void Setup::externalUnload() +{ + FOR_EACH (std::list::const_iterator, it, mTabs) + { + if (*it) + (*it)->externalUnloaded(); + } + unloadModTab(); +} + void Setup::registerWindowForReset(Window *const window) { mWindowsToReset.push_back(window); diff --git a/src/gui/windows/setup.h b/src/gui/windows/setup.h index 9039f4e87..4c9ab2fb7 100644 --- a/src/gui/windows/setup.h +++ b/src/gui/windows/setup.h @@ -73,6 +73,8 @@ class Setup final : public Window, public gcn::ActionListener void widgetResized(const gcn::Event &event) override final; private: + void unloadModTab(); + std::list mTabs; SetupTab *mModsTab; std::list mWindowsToReset; -- cgit v1.2.3-70-g09d2