← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2786: remove windows from the global list on the first close message

 

------------------------------------------------------------
revno: 2786
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2012-01-01 22:25:05 +0100
message:
  remove windows from the global list on the first close message
modified:
  changelog.txt
  win32/DirectoryListingFrame.cpp
  win32/HubFrame.cpp
  win32/PrivateFrame.cpp
  win32/SearchFrame.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt	2011-12-29 14:15:47 +0000
+++ changelog.txt	2012-01-01 21:25:05 +0000
@@ -1,3 +1,5 @@
+* Prevent crashes when closing hub, PM or file list windows (poy)
+
 -- 0.790 2011-12-29 --
 * Fav users frame becomes users frame and shows all users
 * Experimental implementation of KEYP ADC extension

=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp	2011-12-28 14:38:29 +0000
+++ win32/DirectoryListingFrame.cpp	2012-01-01 21:25:05 +0000
@@ -392,8 +392,6 @@
 }
 
 DirectoryListingFrame::~DirectoryListingFrame() {
-	dcassert(lists.find(dl->getUser()) != lists.end());
-	lists.erase(dl->getUser());
 }
 
 class FileListLoader : public Thread {
@@ -517,6 +515,8 @@
 
 bool DirectoryListingFrame::preClosing() {
 	ClientManager::getInstance()->removeListener(this);
+
+	lists.erase(dl->getUser());
 	return true;
 }
 

=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp	2011-12-28 22:05:28 +0000
+++ win32/HubFrame.cpp	2012-01-01 21:25:05 +0000
@@ -271,7 +271,6 @@
 
 HubFrame::~HubFrame() {
 	ClientManager::getInstance()->putClient(client);
-	frames.erase(std::remove(frames.begin(), frames.end(), this), frames.end());
 	clearTaskList();
 }
 
@@ -286,6 +285,8 @@
 	FavoriteManager::getInstance()->removeListener(this);
 	client->removeListener(this);
 	client->disconnect(true);
+
+	frames.erase(std::remove(frames.begin(), frames.end(), this), frames.end());
 	return true;
 }
 

=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp	2011-12-31 18:53:24 +0000
+++ win32/PrivateFrame.cpp	2012-01-01 21:25:05 +0000
@@ -178,7 +178,6 @@
 }
 
 PrivateFrame::~PrivateFrame() {
-	frames.erase(replyTo.getUser());
 }
 
 void PrivateFrame::addChat(const tstring& aLine, bool log) {
@@ -213,6 +212,8 @@
 
 bool PrivateFrame::preClosing() {
 	ClientManager::getInstance()->removeListener(this);
+
+	frames.erase(replyTo.getUser());
 	return true;
 }
 

=== modified file 'win32/SearchFrame.cpp'
--- win32/SearchFrame.cpp	2011-12-23 14:47:37 +0000
+++ win32/SearchFrame.cpp	2012-01-01 21:25:05 +0000
@@ -97,10 +97,8 @@
 	}
 }
 
-
 void SearchFrame::openWindow(TabViewPtr parent, const tstring& str, SearchManager::TypeModes type) {
-	SearchFrame* pChild = new SearchFrame(parent, str, type);
-	frames.insert(pChild);
+	frames.insert(new SearchFrame(parent, str, type));
 }
 
 void SearchFrame::closeAll() {
@@ -375,7 +373,6 @@
 	ClientManager::getInstance()->removeListener(this);
 
 	frames.erase(this);
-
 	return true;
 }