From kde-core-devel Mon Nov 19 22:36:09 2007 From: David Faure Date: Mon, 19 Nov 2007 22:36:09 +0000 To: kde-core-devel Subject: Re: KJob deleting itself too early? Message-Id: <200711192336.10005.faure () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=119551183618696 On Monday 19 November 2007, Andreas Pakulat wrote: > On 19.11.07 23:06:09, David Faure wrote: > > On Sunday 18 November 2007, Andreas Pakulat wrote: > > > Hi, > > > > > > I'd like to know why KJob deletes itself when he's done doing its work? > > > Shouldn't this be done by whoever creates the KJob? > > No, many jobs are fire-and-forget, and when they're not, people would forget to delete them. > > The job is done, it's done, it deletes itself. KDE3's KIO::Job has always worked like that. > > > > > I don't think its a good idea to delete the job behind the back of the > > > user, in particular when you don't know how a KJob instance (or subclass > > > thereof) is used. > > Doesn't matter how it's used: after the job emits finished, it's finished :) > > Yeah, but the problem is I can't access the data the job carries after a > run of the event loop. I'm surprised by this need, but OK. > I don't care if KIO jobs are fire-and-forget, but for a general-purpose > job class in kdelibs/kdecore this just sounds like an uneeded > restriction. In particular this makes it impossible to have KJob provide > the job-implementation for KDevelop VCS support. We cannot change the default behavior of KJob at this point. But a setAutoDelete(false) would be fine with me. Kévin is the maintainer though, he has final say. -- David Faure, faure@kde.org, sponsored by Trolltech to work on KDE, Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).