From 8d80b897b5863372649de9b5f3c8d7234ae47f58 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 May 2011 02:51:51 +0300 Subject: Fix some memory leaks in being, debugwindow, shortcutwindow, skilldialog, map classes. --- src/gui/widgets/tabbedarea.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/gui/widgets/tabbedarea.cpp') diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 6c2ef5b25..b20237c1b 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -442,6 +442,24 @@ gcn::Widget *TabbedArea::getWidgetByIndex(int index) const return mTabs[index].second; } +void TabbedArea::removeAll() +{ + if (getSelectedTabIndex() != -1) + { + setSelectedTab(static_cast(0)); + + } + while (getNumberOfTabs() > 0) + { + const int idx = getNumberOfTabs() - 1; + gcn::Tab *tab = mTabs[idx].first; + Widget *widget = mTabs[idx].second; + removeTab(tab); + delete tab; + delete widget; + } +} + /* void TabbedArea::moveLeft(gcn::Tab *tab) { -- cgit v1.2.3-60-g2f50