fix assertion in monitoredItemMoved
Review Request #101973 - Created July 16, 2011 and discarded
fixes an assertion in EntityTreeModelPrivate::monitoredItemMoved which I could reproduce everytime kmail2 was started in conjunction with the rest of my kde session. restarting kmail afterwards worked fine though. I have lots of filters, maybe it's related. The assertion was in m_childEntities.takeAt() due to srcRow == -1 because indexOf apparently did not find the given itemId... No idea whats going on and whether it's bad but at least this way it's not crashing anymore.
restarted KDE, no crash anymore.
Looking at the code for indexForCollection() it states that an index of -1 is an invalid index so this patch seems sane. Not sure if the below comment changes anything since I could not find the code for that during the short time I looked.
Please do not ship this patch. The patch does not fix the problem and is only a workaround. Not sure yet what the actual problem is but a first guess is that it is related to the collectionFetchStrategy, but I would really need to know more about the state of the etm, to be able to debug this. Anyways there is ongoing work on the etm by skelly and me, so this might be fixed already. If the workaround is really needed, put the check directly after const int srcRow = indexOf<Node::Item>( m_childEntities.value( sourceCollection.id() ), itemId ); (this must never fail), and state it clearly as workaround. Cheers