Question: Should the background parser delete ParseJobs?

David Nolden zwabel at googlemail.com
Mon Nov 2 17:56:30 UTC 2009


Am Montag 02 November 2009 18:46:30 schrieb Milian Wolff:
> On Monday, 2. November 2009 18:17:34 Milian Wolff wrote:
> > On Sunday, 1. November 2009 23:40:13 David Nolden wrote:
> > > Am Samstag 31 Oktober 2009 16:12:48 schrieb Milian Wolff:
> > > > Hi there!
> > > >
> > > > In ~BackgroundParserPrivate() the ParseJob gets deleted, but I wonder
> > > > why? I mean they are owned by the LanguagePlugin, no? Shouldn't they
> > > > delete the jobs?
> > >
> > > Who says they are owned by the language plugin? Usually they are
> > > deleted by BackgroundParser::parseComplete, so the background-parser
> > > owns them.
> >
> > OK, just rechecked with CPP and it doesn't set a parent for the Parsejob,
> > while PHP still does. Will change it.
> 
> Thinking about it - should we not also remove this stuff from
> language/parsejob.h/.cpp ? I can commit this, also affects CPPParseJob as
>  it initilizes KDevelop::ParseJob(url, 0).
Yes, would make sense, as we don't need useless API.

> > Should we add job->setParent(this) in
> > BackgroundParserPrivate::parseDocumentsInternal ? Would potentially save
> > us some code in the dtor, but only if we don't to set
> >             it.value()->setBackgroundParser(0);
> 
> setParent(this) won't work since BackgroundParserPrivate is not a QObject.

All that ownership stuff also affects the way signals are delivered (queued or 
not queued), so I'd rather prefer just leaving that stuff alone, as it works 
now. It's not worth it just to save us 2 lines of code.

Greetings, David




More information about the KDevelop-devel mailing list