Review Request 108770: Fix double-free in ~KCompositeJobPrivate

Kevin Funk krf at
Tue Feb 5 15:39:14 GMT 2013

This is an automatically generated e-mail. To reply, visit:

(Updated Feb. 5, 2013, 3:39 p.m.)

Review request for kdelibs.


Diff updated.

KCompositeJob::clearSubjobs() is a bit tricky. Do we want to setParent(0) all jobs here? Can we assume that the jobs are still valid at this point?

Description (updated)

Fix double-free in ~KCompositeJobPrivate

In case a subjob of KCompositeJob has been deleted, this KCompositeJob
instance will crash as soon as it is being destructed, trying to delete
this subjob again. The reason for this is that KCompositeJob::addSubjob()
does not change the ownership of @p job. So, this job could be still
deleted by ~QObject() by the original parent.

Add tests for this corner case.

This fixes a bug in KDevelop.

1 0x00007ffff7a3f28e in qDeleteAll<QList<KJob*>::const_iterator>
(end=..., begin=...) at /usr/include/qt4/QtCore/qalgorithms.h:322
2 qDeleteAll<QList<KJob*> > (c=QList<KJob *> = {...}) at
/usr/include/qt4/QtCore/qalgorithms.h:330 #3
KCompositeJobPrivate::~KCompositeJobPrivate (this=0x8849850,
__in_chrg=<optimized out>) at ../../kdecore/jobs/kcompositejob.cpp:29
4 0x00007ffff7a3f2c9 in KCompositeJobPrivate::~KCompositeJobPrivate
(this=0x8849850, __in_chrg=<optimized out>) at
5 0x00007ffff7a3fd70 in KJob::~KJob (this=0x880b030,
__in_chrg=<optimized out>) at
6 0x00007ffff1a8e5d9 in KDevelop::BuilderJob::~BuilderJob
(this=0x880b030, __in_chrg=<optimized
out>) at /home/krf/devel/src/kdevplatform/project/builderjob.cpp:158

BUG: 230692
REVIEW: 108770
FIXED-IN: 4.11

This addresses bug 230692.

Diffs (updated)

  kdecore/jobs/kcompositejob.h 6ca8eed3ebf8c6f0f5c68d8843bd09a3ea928bbd 
  kdecore/jobs/kcompositejob.cpp 5ddabd71e5bbb5f0a555a201223a52950b85e786 
  kdecore/tests/CMakeLists.txt f19e563d5d99ad2f2806140c5b21e38b20dbde0d 
  kdecore/tests/kcompositejobtest.h PRE-CREATION 
  kdecore/tests/kcompositejobtest.cpp PRE-CREATION 




Kevin Funk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the kde-core-devel mailing list