summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/npcdialog.cpp12
-rw-r--r--src/net/tmwa/npchandler.cpp7
2 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index d8dc68fd1..e8ea3388f 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -139,6 +139,15 @@ NpcDialog::~NpcDialog()
{
config.removeListener("logNpcInGui", this);
+ clearLayout();
+
+ delete mTextBox;
+ mTextBox = 0;
+ delete mClearButton;
+ mClearButton = 0;
+ delete mButton;
+ mButton = 0;
+
// These might not actually be in the layout, so lets be safe
delete mScrollArea;
mScrollArea = 0;
@@ -157,6 +166,9 @@ NpcDialog::~NpcDialog()
delete mItemLinkHandler;
mItemLinkHandler = 0;
+ delete mListScrollArea;
+ mListScrollArea = 0;
+
instances.remove(this);
}
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 688635942..eb347db44 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -258,6 +258,13 @@ void NpcHandler::endShopping(int beingId _UNUSED_)
void NpcHandler::clearDialogs()
{
+ NpcDialogs::iterator it = mNpcDialogs.begin();
+ NpcDialogs::iterator it_end = mNpcDialogs.end();
+ while (it != it_end)
+ {
+ delete (*it).second.dialog;
+ ++ it;
+ }
mNpcDialogs.clear();
}