Commit c335c606 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Expire dying parent from threading cache before processing children

Fixes a crash in the Model when a thread leader is removed and
ViewJob for its children is started to re-attach the subtree
to a new parent node. The second pass would then get a pointer
to the now-deleted parent from the threading cache leading to
a crash eventually.

This patch makes sure the parent is expired from the cache
before the ViewJobs are started. The cache miss triggers actual
threading calculation in Pass2 and Pass3 and updates our cache.

BUG: 364994
FIXED-IN: 16.08.1
parent 65a412f9
......@@ -2636,7 +2636,7 @@ ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass2
} else {
if (parentId > 0) {
// In second pass we have all available Items in mThreadingCache already. If
// mThreadingCache.parentForItem() returns null, but sets knownParent to true then
// mThreadingCache.parentForItem() returns null, but returns valid parentId then
// the Item was removed from Akonadi and our threading cache is out-of-date.
mparent = findMessageParent(mi);
......@@ -3043,6 +3043,10 @@ ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1
// Remove the message from threading cache before we start moving up the
// children, so that they don't get mislead by the cache
if (dyingMessage->parent()) {
// Handle saving the current selection: if this item was the current before the step
// then zero it out. We have killed it and it's OK for the current item to change.
......@@ -76,6 +76,7 @@ public:
if (mEnabled) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment