summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-01-20 14:15:45 +0300
committerAndrei Karas <akaras@inbox.ru>2013-01-20 14:15:45 +0300
commitd07fba228b5251862ad670e1d4f079c9456fab4b (patch)
tree7c44b5e282bca638de29642b330d5f0a30a97b8b
parentcc7b5b170738c1c17437fdb6740f5af7824ca979 (diff)
downloadmv-d07fba228b5251862ad670e1d4f079c9456fab4b.tar.gz
mv-d07fba228b5251862ad670e1d4f079c9456fab4b.tar.bz2
mv-d07fba228b5251862ad670e1d4f079c9456fab4b.tar.xz
mv-d07fba228b5251862ad670e1d4f079c9456fab4b.zip
Fix crashes on closing client before entering game.
-rw-r--r--src/client.cpp9
-rw-r--r--src/client.h2
-rw-r--r--src/gui/widgets/window.cpp2
3 files changed, 13 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp
index e281ddced..3a2a5f493 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -777,6 +777,9 @@ void Client::gameClear()
if (logger)
logger->log1("Quitting2");
+ delete mCurrentDialog;
+ mCurrentDialog = nullptr;
+
delete gui;
gui = nullptr;
@@ -2873,3 +2876,9 @@ void Client::logEvent(const SDL_Event &event)
break;
};
}
+
+void Client::windowRemoved(const Window *const window)
+{
+ if (instance()->mCurrentDialog == window)
+ instance()->mCurrentDialog = nullptr;
+}
diff --git a/src/client.h b/src/client.h
index bdf62ae0b..a448678d0 100644
--- a/src/client.h
+++ b/src/client.h
@@ -319,6 +319,8 @@ public:
PacketLimit mPacketLimits[PACKET_SIZE + 1];
+ static void windowRemoved(const Window *const window);
+
private:
void initRootDir();
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index af753be2d..bb9e12320 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -151,6 +151,8 @@ Window::~Window()
{
logger->log("Window::~Window(\"%s\")", getCaption().c_str());
+ Client::windowRemoved(this);
+
saveWindowState();
delete mLayout;