Prevent core from crashing if networks are removed while reconnecting.
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 14 Apr 2008 18:48:11 +0000 (18:48 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 14 Apr 2008 18:48:11 +0000 (18:48 +0000)
src/core/coresession.cpp
version.inc

index 94cf39e..d7b9cb1 100644 (file)
@@ -248,8 +248,12 @@ void CoreSession::networkConnected(NetworkId networkid) {
 
 // called now only on /quit and requested disconnects, not on normal disconnects!
 void CoreSession::networkDisconnected(NetworkId networkid) {
-  Core::setNetworkConnected(user(), networkid, false);
-  if(_connections.contains(networkid)) _connections.take(networkid)->deleteLater();
+  // if the network has already been removed, we don't have a networkconnection left either, so we don't do anything
+  // make sure to not depend on the network still existing when calling this function!
+  if(_connections.contains(networkid)) {
+    Core::setNetworkConnected(user(), networkid, false);
+    _connections.take(networkid)->deleteLater();
+  }
 }
 
 void CoreSession::channelJoined(NetworkId id, const QString &channel, const QString &key) {
@@ -433,7 +437,10 @@ void CoreSession::removeNetwork(NetworkId id) {
 }
 
 void CoreSession::destroyNetwork(NetworkId id) {
-  Q_ASSERT(!_connections.contains(id));
+  if(_connections.contains(id)) {
+    // this can happen if the network was reconnecting while being removed
+    _connections.take(id)->deleteLater();
+  }
   Network *net = _networks.take(id);
   if(net && Core::removeNetwork(user(), id)) {
     emit networkRemoved(id);
index 0978066..7f81fdb 100644 (file)
@@ -5,7 +5,7 @@
 
   quasselVersion = "0.2.0-beta1-pre";
   quasselDate = "2008-04-14";
-  quasselBuild = 744;
+  quasselBuild = 745;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 731;