diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-07-03 20:00:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-07-03 20:00:46 +0300 |
commit | a1bd0179b28fa93c771bc5602f64746878f0ffad (patch) | |
tree | ff696a9b98c32441b06ffabf2a8ca7312590c8e3 /src | |
parent | 41953ac4902ca11bb07b0aab53e811ca68ce4f64 (diff) | |
download | mv-a1bd0179b28fa93c771bc5602f64746878f0ffad.tar.gz mv-a1bd0179b28fa93c771bc5602f64746878f0ffad.tar.bz2 mv-a1bd0179b28fa93c771bc5602f64746878f0ffad.tar.xz mv-a1bd0179b28fa93c771bc5602f64746878f0ffad.zip |
fix some leaks on exit.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 4 | ||||
-rw-r--r-- | src/gui/inventorywindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.h | 2 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.h | 2 | ||||
-rw-r--r-- | src/net/inventoryhandler.h | 2 |
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; |