X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fclient%2Ftreemodel.cpp;h=b3f2613cabd44f27f1be59fdcbc168556210306f;hb=a72e2b4a90ce18c58b54e111161691ba008dc47d;hp=cc1b08a873f8f8c7b1e3bf5adc2597fd93689c35;hpb=6f4a6454e49db703bd6336f575bbbeff95388404;p=quassel.git diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index cc1b08a8..b3f2613c 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -127,6 +127,10 @@ void AbstractTreeItem::customEvent(QEvent *event) { if(childRow == -1) return; + // since we are called asynchronously we have to recheck if the item in question still has no childs + if(removeEvent->child()->childCount()) + return; + removeChild(childRow); } @@ -546,11 +550,9 @@ void TreeModel::debug_rowsAboutToBeRemoved(const QModelIndex &parent, int start, qDebug() << "debug_rowsAboutToBeRemoved" << parent << parentItem << parent.data().toString() << rowCount(parent) << start << end; QModelIndex child; - AbstractTreeItem *childItem; for(int i = end; i >= start; i--) { child = parent.child(i, 0); - childItem = parentItem->child(i); - Q_ASSERT(childItem); + Q_ASSERT(parentItem->child(i)); qDebug() << ">>>" << i << child << child.data().toString(); } } @@ -563,11 +565,9 @@ void TreeModel::debug_rowsInserted(const QModelIndex &parent, int start, int end qDebug() << "debug_rowsInserted:" << parent << parentItem << parent.data().toString() << rowCount(parent) << start << end; QModelIndex child; - AbstractTreeItem *childItem; for(int i = start; i <= end; i++) { child = parent.child(i, 0); - childItem = parentItem->child(i); - Q_ASSERT(childItem); + Q_ASSERT(parentItem->child(i)); qDebug() << "<<<" << i << child << child.data().toString(); } }