summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-09 00:03:49 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-09 00:03:49 +0300
commit4d875e356660d5196df8cd1ccc1e84ddfec429fd (patch)
tree151b50342420f473b1a4619042844d5024101ccd /src
parent7d1d6f4c001a80c05fd4f792cb6356ee546367ea (diff)
downloadplus-4d875e356660d5196df8cd1ccc1e84ddfec429fd.tar.gz
plus-4d875e356660d5196df8cd1ccc1e84ddfec429fd.tar.bz2
plus-4d875e356660d5196df8cd1ccc1e84ddfec429fd.tar.xz
plus-4d875e356660d5196df8cd1ccc1e84ddfec429fd.zip
Fix memory leak in ministatus.
Diffstat (limited to 'src')
-rw-r--r--src/gui/ministatus.cpp9
1 files changed, 8 insertions, 1 deletions
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<int>(mIcons.size()))
+ {
+ delete mIcons[index];
+ mIcons.erase(mIcons.begin() + index);
+ }
}
void MiniStatusWindow::drawIcons(Graphics *graphics)