From 61470cb03d26a9c6059c33b0f0e16125f5f6eae4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 10 Feb 2011 02:33:02 +0200 Subject: Fix memory leak on exit in windowmenu. --- src/gui/windowmenu.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 ::iterator it, it_end; + for (it = mButtons.begin(), it_end = mButtons.end(); it != it_end; ++it) + { + Button *btn = dynamic_cast(*it); + if (!btn) + continue; + if (!btn->isVisible()) + { + delete btn; + } + } } void WindowMenu::action(const gcn::ActionEvent &event) -- cgit v1.2.3-70-g09d2