diff options
Diffstat (limited to 'src/gui/skilldialog.cpp')
-rw-r--r-- | src/gui/skilldialog.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index ee1803604..7163d5285 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -144,8 +144,16 @@ class SkillListBox : public ListBox { public: SkillListBox(SkillModel *model): - ListBox(model) - {} + ListBox(model), + mModel(model) + { + } + + ~SkillListBox() + { + delete mModel; + mModel = 0; + } SkillInfo *getSelectedInfo() { @@ -196,6 +204,9 @@ public: unsigned int getRowHeight() const { return 34; } + +private: + SkillModel *mModel; }; class SkillTab : public Tab @@ -308,12 +319,14 @@ void SkillDialog::loadSkills(const std::string &file) { mTabs->setSelectedTab(static_cast<unsigned int>(0)); - while (mTabs->getSelectedTabIndex() != -1) + while (mTabs->getNumberOfTabs() > 0) { - gcn::Tab *tab = mTabs->getSelectedTab(); - if (tab) - mTabs->removeTabWithIndex(mTabs->getSelectedTabIndex()); + const int idx = mTabs->getNumberOfTabs() - 1; + Tab *tab = mTabs->getTabByIndex(idx); + Widget *widget = mTabs->getWidgetByIndex(idx); + mTabs->removeTab(tab); delete tab; + delete widget; } } @@ -363,6 +376,7 @@ void SkillDialog::loadSkills(const std::string &file) scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); tab = new SkillTab("Skills", listbox); + mDeleteTabs.push_back(tab); mTabs->addTab(tab, scroll); @@ -417,6 +431,7 @@ void SkillDialog::loadSkills(const std::string &file) scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); tab = new SkillTab(setName, listbox); + mDeleteTabs.push_back(tab); mTabs->addTab(tab, scroll); } |