diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-06-09 00:03:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-06-09 00:03:49 +0300 |
commit | 4d875e356660d5196df8cd1ccc1e84ddfec429fd (patch) | |
tree | 151b50342420f473b1a4619042844d5024101ccd /src/gui | |
parent | 7d1d6f4c001a80c05fd4f792cb6356ee546367ea (diff) | |
download | manaverse-4d875e356660d5196df8cd1ccc1e84ddfec429fd.tar.gz manaverse-4d875e356660d5196df8cd1ccc1e84ddfec429fd.tar.bz2 manaverse-4d875e356660d5196df8cd1ccc1e84ddfec429fd.tar.xz manaverse-4d875e356660d5196df8cd1ccc1e84ddfec429fd.zip |
Fix memory leak in ministatus.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/ministatus.cpp | 9 |
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) |