On Wednesday 3. June 2015 18:56:05 Milian Wolff wrote: > void QAbstractItemModelPrivate::Persistent::insertMultiAtEnd(const > QModelIndex& key, QPersistentModelIndexData *data) > { > + Q_ASSERT(indexes.count(key) < 2); > QHash<QModelIndex,QPersistentModelIndexData *>::iterator newIt = > - indexes.insertMulti(key, data); > + indexes.insert(key, data); > + return; > QHash<QModelIndex,QPersistentModelIndexData *>::iterator it = newIt + > 1; while (it != indexes.end() && it.key() == key) { > qSwap(*newIt,*it);
This will of course never assert since you removed the insertMulti. Try with Q_ASSERT(indexes.count(key) == 0); > with a developer build, and assertions enabled, everything still works as > expected (just much faster). I ran the following unit tests, all still pass, > or behave just as without this patch: > > qabstractitemmodel > qabstractproxymodel > qsortfilterproxymodel > qtreeview > qlistview > > My own test app also works without asserting. So again - why the multiHash - > obsolete? If so, I'll push the required changes to Qt 4 and Qt 5 to remove > QAbstractItemModelPrivate::Persistent::insertMultiAtEnd. This is really weird, I was pretty sure there is a test that should fail. Something like: //pseudocode changePersistentIndex(QModelIndex(3,0), QModelIndex(2,0)); changePersistentIndex(QModelIndex(2,0), QModelIndex(1,0)); Then you get a problem. -- Olivier Woboq - Qt services and support - http://woboq.com - http://code.woboq.org _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development