From 170aae70566003a30ab1f6f936364484f6a0a097 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 1 Jun 2011 16:20:49 +0300 Subject: Clean variables after deleting. --- src/guichan/gui.cpp | 1 + src/guichan/widgets/dropdown.cpp | 6 ++++++ src/guichan/widgets/icon.cpp | 3 +-- src/guichan/widgets/imagebutton.cpp | 6 ++++++ src/guichan/widgets/tab.cpp | 1 + src/guichan/widgets/tabbedarea.cpp | 6 ++++++ 6 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/guichan/gui.cpp b/src/guichan/gui.cpp index f8376646f..45154fd39 100644 --- a/src/guichan/gui.cpp +++ b/src/guichan/gui.cpp @@ -85,6 +85,7 @@ namespace gcn setTop(NULL); delete mFocusHandler; + mFocusHandler = 0; } void Gui::setTop(Widget* top) diff --git a/src/guichan/widgets/dropdown.cpp b/src/guichan/widgets/dropdown.cpp index c666b47e4..da7ff754c 100644 --- a/src/guichan/widgets/dropdown.cpp +++ b/src/guichan/widgets/dropdown.cpp @@ -106,10 +106,16 @@ namespace gcn } if (mInternalScrollArea) + { delete mScrollArea; + mScrollArea = 0; + } if (mInternalListBox) + { delete mListBox; + mListBox = 0; + } setInternalFocusHandler(NULL); } diff --git a/src/guichan/widgets/icon.cpp b/src/guichan/widgets/icon.cpp index 687fadeab..a040dcc83 100644 --- a/src/guichan/widgets/icon.cpp +++ b/src/guichan/widgets/icon.cpp @@ -83,15 +83,14 @@ namespace gcn if (mInternalImage) { delete mImage; + mImage = 0; } } void Icon::setImage(const Image* image) { if (mInternalImage) - { delete mImage; - } mImage = image; mInternalImage = false; diff --git a/src/guichan/widgets/imagebutton.cpp b/src/guichan/widgets/imagebutton.cpp index a340face3..141b17b79 100644 --- a/src/guichan/widgets/imagebutton.cpp +++ b/src/guichan/widgets/imagebutton.cpp @@ -81,13 +81,19 @@ namespace gcn ImageButton::~ImageButton() { if (mInternalImage) + { delete mImage; + mImage = 0; + } } void ImageButton::setImage(const Image* image) { if (mInternalImage) + { delete mImage; + mImage = 0; + } mImage = image; mInternalImage = false; diff --git a/src/guichan/widgets/tab.cpp b/src/guichan/widgets/tab.cpp index 760e77a18..b0d0c7982 100644 --- a/src/guichan/widgets/tab.cpp +++ b/src/guichan/widgets/tab.cpp @@ -69,6 +69,7 @@ namespace gcn Tab::~Tab() { delete mLabel; + mLabel = 0; } void Tab::adjustSize() diff --git a/src/guichan/widgets/tabbedarea.cpp b/src/guichan/widgets/tabbedarea.cpp index d430a76a3..26a45c1f0 100644 --- a/src/guichan/widgets/tabbedarea.cpp +++ b/src/guichan/widgets/tabbedarea.cpp @@ -81,10 +81,15 @@ namespace gcn remove(mWidgetContainer); delete mTabContainer; + mTabContainer = 0; delete mWidgetContainer; + mWidgetContainer = 0; for (unsigned int i = 0; i < mTabsToDelete.size(); i++) + { delete mTabsToDelete[i]; + mTabsToDelete[i] = 0; + } } void TabbedArea::addTab(const std::string& caption, Widget* widget) @@ -163,6 +168,7 @@ namespace gcn { mTabsToDelete.erase(iter2); delete tab; + tab = 0; break; } } -- cgit v1.2.3-60-g2f50