Fixed those nasty "Client::updateLastSeen(): Unknown buffer $bufferId" messages.
authorMarcus Eggenberger <egs@quassel-irc.org>
Wed, 27 Feb 2008 13:29:01 +0000 (13:29 +0000)
committerMarcus Eggenberger <egs@quassel-irc.org>
Wed, 27 Feb 2008 13:29:01 +0000 (13:29 +0000)
This requieres a core restart for buffers which have already been deleted.

src/client/client.cpp
version.inc

index 2af930f..3326b79 100644 (file)
@@ -536,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>() == 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) {
index a639d5e..bd9f71e 100644 (file)
@@ -5,7 +5,7 @@
 
   quasselVersion = "0.2.0-alpha1+";
   quasselDate = "2008-02-27";
-  quasselBuild = 588;
+  quasselBuild = 590;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 563;