X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=3326b79d508bb74140b2c0bcdcffc47afdd38720;hp=24f1726c7e7598df19253d32b127c03bfaeb870c;hb=1f7cffc751c022ddea816db471f7870a60dc0d1c;hpb=e9189ebd5af607385629d3aa74dc9fc15bb642f4 diff --git a/src/client/client.cpp b/src/client/client.cpp index 24f1726c..3326b79d 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -171,8 +171,10 @@ Buffer *Client::buffer(BufferInfo bufferInfo) { emit client->bufferUpdated(bufferInfo); // I don't like this: but currently there isn't really a prettier way: - QModelIndex bufferIdx = networkModel()->bufferIndex(bufferInfo.bufferId()); - bufferModel()->setCurrentIndex(bufferModel()->mapFromSource(bufferIdx)); + if(isSynced()) { // this slows down syncing a lot, so disable it during sync + QModelIndex bufferIdx = networkModel()->bufferIndex(bufferInfo.bufferId()); + bufferModel()->setCurrentIndex(bufferModel()->mapFromSource(bufferIdx)); + } } Q_ASSERT(buff); return buff; @@ -534,18 +536,31 @@ void Client::removeBuffer(BufferId id) { } void Client::bufferRemoved(BufferId bufferId) { + // first remove the buffer from has. this prohibits further lastSeenUpdates + Buffer *buff = 0; + if(_buffers.contains(bufferId)) { + buff = _buffers.take(bufferId); + disconnect(buff, 0, this, 0); + } + + // then we select a sane buffer (status buffer) + /* we have to manually select a buffer because otherwise inconsitent changes + * to the model might occur: + * the result of a buffer removal triggers a change in the selection model. + * the newly selected buffer might be a channel that hasn't been selected yet + * and a new nickview would be created (which never heard of the "rowsAboutToBeRemoved"). + * this new view (and/or) its sort filter will then only receive a "rowsRemoved" signal. + */ QModelIndex current = bufferModel()->currentIndex(); if(current.data(NetworkModel::BufferIdRole).value() == bufferId) { - // select the status buffer if the currently displayed buffer is about to be removed bufferModel()->setCurrentIndex(current.sibling(0,0)); } - + + // and remove it from the model networkModel()->removeBuffer(bufferId); - if(_buffers.contains(bufferId)) { - Buffer *buff = _buffers.take(bufferId); - disconnect(buff, 0, this, 0); + + if(buff) buff->deleteLater(); - } } void Client::bufferRenamed(BufferId bufferId, const QString &newName) {