D14413: subversion plugin: fix ThreadWeaver job lifetime race condition
Friedrich W. H. Kossebau
noreply at phabricator.kde.org
Thu Jul 26 22:54:15 BST 2018
kossebau created this revision.
kossebau added a reviewer: KDevelop.
Restricted Application added a project: KDevelop.
Restricted Application added a subscriber: kdevelop-devel.
kossebau requested review of this revision.
REVISION 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.
REPOSITORY
R32 KDevelop
BRANCH
fixsvnjobaccessafterdelete
REVISION DETAIL
https://phabricator.kde.org/D14413
AFFECTED FILES
plugins/subversion/svnblamejob.cpp
plugins/subversion/svndiffjob.cpp
plugins/subversion/svninfojob.cpp
plugins/subversion/svninternaljobbase.cpp
plugins/subversion/svninternaljobbase.h
plugins/subversion/svnjobbase.cpp
plugins/subversion/svnjobbase.h
plugins/subversion/svnlogjob.cpp
plugins/subversion/svnstatusjob.cpp
To: kossebau, #kdevelop
Cc: kdevelop-devel, antismap, iodelay, vbspam, njensen, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20180726/392906c5/attachment.html>
More information about the KDevelop-devel
mailing list