[PATCH] Fix ThreadWeaver JobCollection deletion race
apaku at gmx.de
Wed Mar 26 21:38:23 UTC 2008
On 26.03.08 18:30:58, Robert Knight wrote:
> I noticed another problem in KDevelop. When a parse job completes,
> BackgroundParser emits parseJobFinished(Job*) and then schedules
> deletion of the Job. If the connection from parseJobFinished() to a
> receiver (eg. the ProblemWidget) is queued then the Job may be deleted
> before the slot is called.
> The simplest fix is to make sure all connections to parseJobFinished()
> are direct and add a note that this must be the case in the method
> documentation. This could cause problems though with third party
> plugins if they don't respect this.
IMHO its a really bad idea to expose the jobs pointer via public api and
advertise usage of the pointer in slots and at the same time delete the
job object behind the back of the slot-users.
So maybe we should just add this possibility to parse jobs as well, that
way if somebody queues a parse job he can also make sure he deletes the
parse job himself if he expects need for the parse-job data after the
job finished. Thats what I did for KJob to be able to use the jobs after
the work has been done (in the vcs support).
Try to value useful qualities in one who loves you.
More information about the KDevelop-devel