SmartRange revisions in ParseJobs

David Nolden zwabel at
Sat Feb 20 12:52:22 UTC 2010

Am Freitag 19 Februar 2010 16:18:24 schrieb Milian Wolff:
> Hey all, esp. David:
> With recent trunk you'll see that Cristoph added a warning when the
> clearRevision is called from the wrong thread (the locks are apparently
>  per- thread else all kind of havoc could happen).
> The parsejobs do useRevision in contentsAvailableFromEditor but
>  clearRevision in their dtor, both are in different threads (form in the
>  background due to backgroundparser, latter somewhere else due to
>  signal/slot connections).
> So how should we fix that properly in KDevelop? Introduce something like a
> SmartRevisionLocker that does clearRevision when it gets closed down, and
>  set this up in the ::run() of each ParseJob? I can't see how it could be
>  completely hidden from the implementation of a language parsejob though...
> Ideas?

Hmm, the real solution would be changing the API around useRevision and 
clearRevision. However as that's not possible, I guess the only solution will 
be adding a function like "finished()" to ParseJob which does the cleanup, and 
making sure that it's always called within the parse-thread when the parse-job 
is ready.

Yes, ideally it should be completely hidden from the parse-job implementation 
itself. Maybe the thread-weaver has some API that could be used for that?

Greetings, David

More information about the KDevelop-devel mailing list