Qt4 delete this vs deleteLater()
nekkar at libero.it
Sun Aug 14 15:38:59 BST 2005
Thanks, Thiago, for your reply.
On Saturday 13 August 2005 23:42, Thiago Macieira wrote:
> Dario Massarin wrote:
> >So my question is: "What do you think about this?". Should we go through
> >kdelibs and replace, in every QObject class, "delete this" with
> > deleteLater() or there are cases in which this is not the right
> > solution?
> There are cases when deleteLater() may be unnecessary. So it is a
> case-by-case basis.
Yes, yes, I know that this substitution depends on the specific case and that
there are cases where this is not necessary. But at least, from your words,
it seems that it is always correct.
Ok. This mail was just to raise the problem with all the list on the fact that
with Qt4 lots of "delete this" must be substituted with deleteLater().
> However, deleting an object from a slot is a BAD idea: you're deleting an
> object that is in use. I am saying that from the library developer point
> of view.
Ehm.. If I didn't underline this enough, this isn't my code. I'm talking about
KDELIBS (kdelibs/kio/kio/job.cpp). The problem I noticed was affecting
kdelibs and I committed a patch that solved the problem.
> As for deleteLater(), don't think it'll magically solve all problems.
More information about the kde-core-devel