diff options
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r-- | src/gui/chat.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 6ad45fc8..103a2647 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -119,7 +119,7 @@ ChatWindow::~ChatWindow() { config.setValue("ReturnToggles", mReturnToggles); delete mRecorder; - delete_all(mWhispers); + removeAllWhispers(); delete mItemLinkHandler; } @@ -235,10 +235,6 @@ bool ChatWindow::isInputFocused() const void ChatWindow::removeTab(ChatTab *tab) { - // Prevent removal of the local chat tab - if (tab == localChatTab) - return; - mChatTabs->removeTab(tab); } @@ -260,6 +256,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(); |