subversion plugin: fix ThreadWeaver job lifetime race condition

Authored by kossebau on Jul 26 2018, 9:43 PM.

Description

subversion plugin: fix ThreadWeaver job lifetime race condition

Summary:
The old code had the internal ThreadWeaver job being killed via the QObject
child memory management from the outer KJob-based job object.
Though this was done based on a signal emitted from the ThreadWeaver
execution thread, when the internal ThreadWeaver job was still going to be
used by the internal reference in the execution completion code.

While the actual current ThreadWeaver code then is not accessing any member
data and just using the pointer to the otherwisse already deleted object,
this at least is not liked by ASan which detects a heap-use-after-free,
resulting e.g. in failing unit tests on CI now and then.

This patch fixes this by passing the ThreadWeaver job instance via a
QSHaredPointer which then is shared by both the parent KJob and the
ThreadWeaver Queue, so the deletion will be done by the last one handling
it.

Test Plan: Subversion plugin still works for what I tested, unit tests still pass.

Reviewers: KDevelop, mwolff

Reviewed By: KDevelop, mwolff

Subscribers: mwolff, kdevelop-devel

Tags: KDevelop

Differential Revision: https://phabricator.kde.org/D14413