Review Request: Prevent crash in KJob::emitResult() if job is deleted

Aurélien Gâteau agateau at kde.org
Thu Dec 2 16:51:19 GMT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/6022/
-----------------------------------------------------------

(Updated 2010-12-02 16:51:19.493828)


Review request for kdelibs and Kevin Ottens.


Changes
-------

Print a warning when job has already been deleted.


Summary
-------

If a someone calls "delete job" on a slot connected to the KJob::result() signal, KJob crashes because the job does not exist anymore when execution comes back to KJob::emitResult(). I added a guard to prevent that. An alternative would be to call deleteLater() before emitting the signals but I was afraid it would cause trouble if slots connected to the emitted signals used event loops.


This addresses bug 241562.
    https://bugs.kde.org/show_bug.cgi?id=241562


Diffs (updated)
-----

  trunk/KDE/kdelibs/kdecore/jobs/kjob.cpp 1202165 
  trunk/KDE/kdelibs/kdecore/tests/kjobtest.h 1202165 
  trunk/KDE/kdelibs/kdecore/tests/kjobtest.cpp 1202165 

Diff: http://svn.reviewboard.kde.org/r/6022/diff


Testing
-------

Wrote a unit-test to demonstrate the problem. This also helps with bug #241562 although I have another request prepared to hopefully definitely nail it down.


Thanks,

Aurélien

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20101202/5bf683cd/attachment.htm>


More information about the kde-core-devel mailing list