From: Marcus Eggenberger Date: Fri, 19 Oct 2007 19:19:28 +0000 (+0000) Subject: some minor cosmetics... X-Git-Tag: 0.1.0~118 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=28d87d2379f9af82077d67d034dc93f7e2882651 some minor cosmetics... --- diff --git a/src/client/client.cpp b/src/client/client.cpp index 6b941c65..2cb2e128 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -144,10 +144,6 @@ Client::Client(QObject *parent) } Client::~Client() { -// since we're now the parent of buffers this should be no longer needed - -// foreach(Buffer *buf, buffers.values()) delete buf; // this is done by disconnectFromCore()! FIXME? -// Q_ASSERT(!buffers.count()); } void Client::init() { @@ -237,16 +233,9 @@ void Client::connectToCore(const QVariantMap &conn) { } void Client::disconnectFromCore() { - if(clientMode == RemoteCore) { - socket->close(); - //QAbstractSocket *sock = qobject_cast(socket); - //Q_ASSERT(sock); - //sock->disconnectFromHost(); - } else { - socket->close(); - //disconnectFromLocalCore(); + socket->close(); + if(clientMode == LocalCore) coreSocketDisconnected(); - } } void Client::coreSocketConnected() { @@ -267,17 +256,17 @@ void Client::coreSocketDisconnected() { /* Clear internal data. Hopefully nothing relies on it at this point. */ _bufferModel->clear(); - // Buffers, if deleted, send a signal that causes their removal from buffers and bufferInfos. - // So we cannot simply go through the array in a loop (or use qDeleteAll) for deletion... - while(!_buffers.empty()) { - delete _buffers.take(_buffers.keys()[0]); + + foreach(Buffer *buffer, _buffers.values()) { + delete buffer; } Q_ASSERT(_buffers.empty()); - while(!_networkInfo.empty()) { - delete _networkInfo.take(_networkInfo.keys()[0]); + foreach(NetworkInfo *networkinfo, _networkInfo.values()) { + delete networkinfo; } - + Q_ASSERT(_networkinfo.empty()); + coreConnectionInfo.clear(); sessionData.clear(); layoutQueue.clear();