ETM refcounting fixes
Review Request #113680 - Created Nov. 6, 2013 and submitted - Latest diff uploaded
|dvratil, skelly, vkrause|
This review contains 4 different patches since I seem to be unable to upload patches that depend on each other. Sorry about that, but it should still be reviewable. You can also find the commits in email@example.com:clones/kdepimlibs/cmollekopf/kdepimlibs dev/refcounting. Together they should fix http://bugs.kde.org/show_bug.cgi?id=312460, as well as the buffering of reference counted collections. => Makes reference counting work as it should. I already uploaded a diff separately for the first patch (that is included here as well), that just fixes 312460, but not the other related problems. ----- Simplify logic by using isMonitored consequently. ----- Only buffer a collection after the refcount reaches zero. Before a collection that was dereffe'd at least once (althouh the refcount is still >0), would already be buffered, resulting in the buffer being occupied by reffe'd collections (which is pointless). ----- Don't keep outdated copies of items. A collection is purged if reference counting is used and a collection exits the buffer after being referenced. By not purging the items, it becomes possile that we miss updates, and when refetching the collection because it's referenced again, we don't emit change notifications because the items were in the model already. Since we anyways have to fetch all items, we can as well purge all items. Alternatives: * compare revisions and emit change notifications if necessary in itemsFetched * Still emit notifications in the monitor for modifications only ----- Fixed fetching of items that exited the buffer after being referenced. After a collection exits the buffer after being referenced, the monitor no longer emits updates for this collection. It is therefore necessary for the ETM to refetch the items to get missing updates.
Tested manually, I'll follow up with unittests.