subversion plugin: fix ThreadWeaver job lifetime race condition
ClosedPublic

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

Details

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.

Diff Detail

Repository
R32 KDevelop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau created this revision.Jul 26 2018, 9:54 PM
Restricted Application added a project: KDevelop. · View Herald TranscriptJul 26 2018, 9:54 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald Transcript
kossebau requested review of this revision.Jul 26 2018, 9:54 PM
mwolff accepted this revision.Jul 27 2018, 8:56 AM
mwolff added a subscriber: mwolff.

nasty issue, thanks for fixing it

This revision is now accepted and ready to land.Jul 27 2018, 8:56 AM
This revision was automatically updated to reflect the committed changes.