summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-21 00:42:40 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-21 02:50:12 +0300
commitf3fcd24e8597feaabab67d0d354aef803958a465 (patch)
tree06b17d34696a7acca422a26352d022f31e51ce90
parentdff5c359fc0aec10a63556b7072d5e724ec0bf8e (diff)
downloadManaVerse-f3fcd24e8597feaabab67d0d354aef803958a465.tar.gz
ManaVerse-f3fcd24e8597feaabab67d0d354aef803958a465.tar.bz2
ManaVerse-f3fcd24e8597feaabab67d0d354aef803958a465.tar.xz
ManaVerse-f3fcd24e8597feaabab67d0d354aef803958a465.zip
Fix possible crash with nav poinst rename dialog.
-rw-r--r--src/game.cpp3
-rw-r--r--src/gui/popupmenu.cpp9
-rw-r--r--src/gui/popupmenu.h2
-rw-r--r--src/gui/viewport.cpp6
-rw-r--r--src/gui/viewport.h2
5 files changed, 22 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 32201a85b..f3d57df9e 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -984,6 +984,9 @@ void Game::changeMap(const std::string &mapPath)
{
resetAdjustLevel();
+ if (viewport)
+ viewport->clearPopup();
+
// Clean up floor items, beings and particles
if (actorSpriteManager)
actorSpriteManager->clear();
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 5a75cb71d..c6838079c 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -2204,6 +2204,15 @@ void PopupMenu::showPopup(const int x, const int y, gcn::ListModel *model)
showPopup(x, y);
}
+void PopupMenu::clear()
+{
+ if (mDialog)
+ {
+ mDialog->close();
+ mDialog = nullptr;
+ }
+}
+
RenameListener::RenameListener() :
gcn::ActionListener(),
mMapItem(nullptr),
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index 431d7e7de..95cc3f65c 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -174,6 +174,8 @@ class PopupMenu final : public Popup, public LinkHandler
void handleLink(const std::string &link,
gcn::MouseEvent *event A_UNUSED) override;
+ void clear();
+
private:
void addPlayerRelation(std::string name);
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 5175d683d..fcd62caa5 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -1033,3 +1033,9 @@ void Viewport::validateSpeed() const
Game::instance()->setValidSpeed();
}
}
+
+void Viewport::clearPopup()
+{
+ if (mPopupMenu)
+ mPopupMenu->clear();
+}
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 3724b4925..7cf02aecf 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -276,6 +276,8 @@ class Viewport final : public WindowContainer,
void returnCamera();
+ void clearPopup();
+
protected:
friend class ActorSpriteManager;