From 4d875e356660d5196df8cd1ccc1e84ddfec429fd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 9 Jun 2011 00:03:49 +0300 Subject: Fix memory leak in ministatus. --- src/gui/ministatus.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index 6809a5149..4c57812d5 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -43,6 +43,7 @@ #include "net/playerhandler.h" #include "net/gamehandler.h" +#include "utils/dtor.h" #include "utils/gettext.h" #include "utils/stringutils.h" @@ -126,6 +127,8 @@ MiniStatusWindow::~MiniStatusWindow() mTextPopup = 0; delete mStatusPopup; mStatusPopup = 0; + delete_all(mIcons); + mIcons.clear(); Inventory *inv = PlayerInfo::getInventory(); if (inv) @@ -194,7 +197,11 @@ void MiniStatusWindow::setIcon(int index, AnimatedSprite *sprite) void MiniStatusWindow::eraseIcon(int index) { - mIcons.erase(mIcons.begin() + index); + if (index < static_cast(mIcons.size())) + { + delete mIcons[index]; + mIcons.erase(mIcons.begin() + index); + } } void MiniStatusWindow::drawIcons(Graphics *graphics) -- cgit v1.2.3-70-g09d2