diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-02-10 02:33:02 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-02-10 02:33:02 +0200 |
commit | 61470cb03d26a9c6059c33b0f0e16125f5f6eae4 (patch) | |
tree | 4efd20ddd9fa540127ab8ae4bc0fa735b3307e0a /src/gui/windowmenu.cpp | |
parent | 415af32db3321d4b3a8026da46dda451cf44c735 (diff) | |
download | manaplus-61470cb03d26a9c6059c33b0f0e16125f5f6eae4.tar.gz manaplus-61470cb03d26a9c6059c33b0f0e16125f5f6eae4.tar.bz2 manaplus-61470cb03d26a9c6059c33b0f0e16125f5f6eae4.tar.xz manaplus-61470cb03d26a9c6059c33b0f0e16125f5f6eae4.zip |
Fix memory leak on exit in windowmenu.
Diffstat (limited to 'src/gui/windowmenu.cpp')
-rw-r--r-- | src/gui/windowmenu.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 6926e18ae..cfb482841 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -109,6 +109,17 @@ WindowMenu::~WindowMenu() delete mTextPopup; mTextPopup = 0; mButtonNames.clear(); + std::list <gcn::Button*>::iterator it, it_end; + for (it = mButtons.begin(), it_end = mButtons.end(); it != it_end; ++it) + { + Button *btn = dynamic_cast<Button*>(*it); + if (!btn) + continue; + if (!btn->isVisible()) + { + delete btn; + } + } } void WindowMenu::action(const gcn::ActionEvent &event) |