From 23e0b9550304fa4c8f412c09ce67d307d1878312 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 May 2015 00:32:10 +0300 Subject: Fix possible crash on exit with opened storage window. --- src/client.cpp | 3 +++ src/game.cpp | 1 + src/gui/gui.cpp | 2 ++ src/net/ea/inventoryhandler.cpp | 4 ++-- 4 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index 8ab79ae25..939afef18 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -77,6 +77,7 @@ #include "gui/widgets/button.h" #include "gui/widgets/desktop.h" +#include "gui/widgets/windowcontainer.h" #include "net/chathandler.h" #include "net/download.h" @@ -583,6 +584,8 @@ void Client::gameClear() eventsManager.shutdown(); WindowManager::deleteWindows(); + if (windowContainer) + windowContainer->slowLogic(); stopTimers(); diff --git a/src/game.cpp b/src/game.cpp index e7ab0cb10..8495a39a0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -101,6 +101,7 @@ #include "net/generalhandler.h" #include "net/gamehandler.h" +#include "net/inventoryhandler.h" #include "net/packetcounters.h" #include "net/serverfeatures.h" diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index b5b1ab414..39ab67be1 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -271,6 +271,8 @@ Gui::~Gui() delete2(mSecureFont); delete2(mInfoParticleFont); delete2(mNpcFont); + if (windowContainer) + windowContainer->slowLogic(); delete getTop(); delete2(guiInput); diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index e9bc4e236..e540b9bef 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -322,9 +322,9 @@ void InventoryHandler::destroyStorage() BLOCK_START("InventoryHandler::closeStorage") if (storageWindow) { - storageWindow->unsetInventory(); + InventoryWindow *const inv = storageWindow; storageWindow->close(); - storageWindow = nullptr; + inv->unsetInventory(); } BLOCK_END("InventoryHandler::closeStorage") } -- cgit v1.2.3-70-g09d2