summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-03 20:00:46 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-03 20:00:46 +0300
commita1bd0179b28fa93c771bc5602f64746878f0ffad (patch)
treeff696a9b98c32441b06ffabf2a8ca7312590c8e3
parent41953ac4902ca11bb07b0aab53e811ca68ce4f64 (diff)
downloadmanaplus-a1bd0179b28fa93c771bc5602f64746878f0ffad.tar.gz
manaplus-a1bd0179b28fa93c771bc5602f64746878f0ffad.tar.bz2
manaplus-a1bd0179b28fa93c771bc5602f64746878f0ffad.tar.xz
manaplus-a1bd0179b28fa93c771bc5602f64746878f0ffad.zip
fix some leaks on exit.
-rw-r--r--src/client.cpp4
-rw-r--r--src/gui/inventorywindow.cpp2
-rw-r--r--src/gui/widgets/dropdown.cpp5
-rw-r--r--src/gui/widgets/dropdown.h2
-rw-r--r--src/net/ea/inventoryhandler.cpp6
-rw-r--r--src/net/ea/inventoryhandler.h2
-rw-r--r--src/net/inventoryhandler.h2
7 files changed, 19 insertions, 4 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 89fa1dc4e..d9f57854f 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -73,6 +73,7 @@
#include "net/gamehandler.h"
#include "net/generalhandler.h"
#include "net/guildhandler.h"
+#include "net/inventoryhandler.h"
#include "net/loginhandler.h"
#include "net/net.h"
#include "net/npchandler.h"
@@ -765,6 +766,9 @@ void Client::gameClear()
SDL_RemoveTimer(mLogicCounterId);
SDL_RemoveTimer(mSecondsCounterId);
+ if (Net::getInventoryHandler())
+ Net::getInventoryHandler()->clear();
+
// Unload XML databases
CharDB::unload();
ColorDB::unload();
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 323830e33..a9a096d73 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -275,7 +275,7 @@ InventoryWindow::~InventoryWindow()
if (!invInstances.empty())
invInstances.front()->updateDropButton();
- mSortDropDown->hideDrop();
+ mSortDropDown->hideDrop(false);
delete mSortModel;
mSortModel = nullptr;
//delete mTextPopup;
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 4ebbcc001..e8d4006a2 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -355,9 +355,10 @@ void DropDown::keyPressed(gcn::KeyEvent& keyEvent)
keyEvent.consume();
}
-void DropDown::hideDrop()
+void DropDown::hideDrop(bool event)
{
- distributeActionEvent();
+ if (event)
+ distributeActionEvent();
mPopup->setVisible(false);
}
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index da0251260..58b01b288 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -118,7 +118,7 @@ class DropDown final : public gcn::ActionListener,
void foldUp();
- void hideDrop();
+ void hideDrop(bool event = true);
int getSelected() const;
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 086a05102..65f0d87a0 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -95,6 +95,12 @@ InventoryHandler::~InventoryHandler()
mStorage = nullptr;
}
+void InventoryHandler::clear()
+{
+ delete mStorage;
+ mStorage = nullptr;
+}
+
bool InventoryHandler::canSplit(const Item *const item A_UNUSED) const
{
return false;
diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h
index b398053e3..2497d9dd5 100644
--- a/src/net/ea/inventoryhandler.h
+++ b/src/net/ea/inventoryhandler.h
@@ -149,6 +149,8 @@ class InventoryHandler : public Net::InventoryHandler
~InventoryHandler();
+ void clear();
+
bool canSplit(const Item *const item) const override A_WARN_UNUSED;
void splitItem(const Item *const item,
diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h
index 39e7bf8ba..97a88ca04 100644
--- a/src/net/inventoryhandler.h
+++ b/src/net/inventoryhandler.h
@@ -36,6 +36,8 @@ class InventoryHandler
virtual ~InventoryHandler()
{ }
+ virtual void clear() = 0;
+
virtual void equipItem(const Item *const item) const = 0;
virtual void unequipItem(const Item *const item) const = 0;