From: Manuel Nickschas Date: Mon, 14 Apr 2008 18:48:11 +0000 (+0000) Subject: Prevent core from crashing if networks are removed while reconnecting. X-Git-Tag: 0.2.0-beta1~45 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=08792d799bcff809f96ca0c04c9f9eadd119dc31 Prevent core from crashing if networks are removed while reconnecting. --- diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 94cf39eb..d7b9cb19 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -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); diff --git a/version.inc b/version.inc index 0978066d..7f81fdb0 100644 --- a/version.inc +++ b/version.inc @@ -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;