[PATCH] Fix ThreadWeaver JobCollection deletion race

David Nolden zwabel at googlemail.com
Thu Mar 27 14:06:35 UTC 2008


On Wednesday 26 March 2008 22:38:23 Andreas Pakulat wrote:
> 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).
>
> Andreas

Wouldn't the perfect solution here be using shared-pointers(KSharedPtr) for 
jobs?

The job would be automatically deleted exactly when it isn't needed any 
more(This also works with queued connections, as long as the job is given as 
KSharedPtr<Job>).

Greetings, David 




More information about the KDevelop-devel mailing list