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. Backtrace: 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 ../../kdecore/jobs/kcompositejob.cpp:30 5 0x00007ffff7a3fd70 in KJob::~KJob (this=0x880b030, __in_chrg=<optimized out>) at ../../kdecore/jobs/kjob.cpp:73 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
parent
4fb6b5c1
Please register or sign in to comment