[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: DO NOT delete QObjects, mmmkay?
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2007-11-08 21:50:40
Message-ID: 20071108215040.GB32334 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]

On 08.11.07 14:17:15, Aaron J. Seigo wrote:
> On Thursday 08 November 2007, Andreas Hartmetz wrote:
> > All in all I have fixed three or four crashes in various KDE modules where
> > QObjects were deleted while a signal/slot call involving that QObject was
> > going on.
> 
> p.s. the usual solution when you need to have a QObject deleted is to call 
> deleteLater() on the object instead of delete'ing it with the C++ keyword.

Yeap, though I just had a case where I needed 2 event-loop runs to
safely delete some qobject-derived stuff (in particular plugins).

> p.p.s. the QObject::destroyed(QObject*) signal can be very handy at times, 
> too.

That helped in my case, deleting the first QObject with deleteLater and
the next QObjects then when the signal is emitted...

Andreas

-- 
Do not overtax your powers.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic