summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/chat.cpp25
-rw-r--r--src/gui/chat.h2
-rw-r--r--src/gui/widgets/whispertab.cpp3
3 files changed, 24 insertions, 6 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index d53bcf0a..f87a8a3d 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -117,7 +117,7 @@ ChatWindow::~ChatWindow()
{
config.setValue("ReturnToggles", mReturnToggles);
delete mRecorder;
- delete_all(mWhispers);
+ removeAllWhispers();
delete mItemLinkHandler;
}
@@ -233,10 +233,6 @@ bool ChatWindow::isInputFocused() const
void ChatWindow::removeTab(ChatTab *tab)
{
- // Prevent removal of the local chat tab
- if (tab == localChatTab)
- return;
-
mChatTabs->removeTab(tab);
}
@@ -258,6 +254,25 @@ void ChatWindow::removeWhisper(const std::string &nick)
mWhispers.erase(tempNick);
}
+void ChatWindow::removeAllWhispers()
+{
+ TabMap::iterator iter;
+ std::list<ChatTab*> tabs;
+
+ for (iter = mWhispers.begin(); iter != mWhispers.end(); ++iter)
+ {
+ tabs.push_back(iter->second);
+ }
+
+ for (std::list<ChatTab*>::iterator it = tabs.begin();
+ it != tabs.end(); ++it)
+ {
+ delete *it;
+ }
+
+ mWhispers.clear();
+}
+
void ChatWindow::chatInput(const std::string &msg)
{
ChatTab *tab = getFocused();
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 3de2b146..e49d02c9 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -186,6 +186,8 @@ class ChatWindow : public Window,
void removeWhisper(const std::string &nick);
+ void removeAllWhispers();
+
void autoComplete();
std::string autoCompleteHistory(std::string partName);
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index 858a2e6b..7542e251 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -41,7 +41,8 @@ WhisperTab::WhisperTab(const std::string &nick) :
WhisperTab::~WhisperTab()
{
- chatWindow->removeWhisper(mNick);
+ if (chatWindow)
+ chatWindow->removeWhisper(mNick);
}
void WhisperTab::handleInput(const std::string &msg)