From: Marcus Eggenberger Date: Fri, 6 Feb 2009 16:46:35 +0000 (+0100) Subject: fixing crash on disconnect X-Git-Tag: 0.4.0~115 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=46d75f41de7c1aaee605c096da28d4b0d8abf138 fixing crash on disconnect --- diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index ee333cee..939fcb1d 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -45,6 +45,7 @@ NetworkItem::NetworkItem(const NetworkId &netid, AbstractTreeItem *parent) // as we "sync" the dataChanged() signals of NetworkItem and StatusBufferItem setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); connect(this, SIGNAL(networkDataChanged(int)), this, SIGNAL(dataChanged(int))); + connect(this, SIGNAL(beginRemoveChilds(int, int)), this, SLOT(onBeginRemoveChilds(int, int))); } QVariant NetworkItem::data(int column, int role) const { diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index dfad3c21..5a026c99 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -262,7 +262,8 @@ bool BufferViewFilter::filterAcceptBuffer(const QModelIndex &source_bufferIndex) if(!config()->bufferList().contains(bufferId) && !_editMode) { // add the buffer if... - if(config()->isInitialized() && !config()->removedBuffers().contains(bufferId) // it hasn't been manually removed and either + if(config()->isInitialized() + && !config()->removedBuffers().contains(bufferId) // it hasn't been manually removed and either && ((config()->addNewBuffersAutomatically() && !config()->temporarilyRemovedBuffers().contains(bufferId)) // is totally unknown to us (a new buffer)... || (config()->temporarilyRemovedBuffers().contains(bufferId) && activityLevel > BufferInfo::OtherActivity))) { // or was just temporarily hidden and has a new message waiting for us. addBuffer(bufferId); @@ -313,10 +314,15 @@ bool BufferViewFilter::filterAcceptsRow(int source_row, const QModelIndex &sourc return false; } - if(!source_parent.isValid()) + NetworkModel::ItemType childType = (NetworkModel::ItemType)sourceModel()->data(child, NetworkModel::ItemTypeRole).toInt(); + switch(childType) { + case NetworkModel::NetworkItemType: return filterAcceptNetwork(child); - else + case NetworkModel::BufferItemType: return filterAcceptBuffer(child); + default: + return false; + } } bool BufferViewFilter::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const { @@ -377,6 +383,9 @@ QVariant BufferViewFilter::icon(const QModelIndex &index) const { return QVariant(); QModelIndex source_index = mapToSource(index); + if(sourceModel()->data(source_index, NetworkModel::ItemTypeRole).toInt() != NetworkModel::BufferItemType) + return QVariant(); + if(sourceModel()->data(source_index, NetworkModel::BufferTypeRole).toInt() != BufferInfo::QueryBuffer) return QVariant();