IIRC the list is stored in the event list, and it will go over each one..  Its 
not terribly expensive but isn't free either.

The only time I every call deleteLater is when I have to delete something, AND 
the function I am in, is in the middle of the event loop, AND the object will 
be used again, ie QEvent flows

Scott

-----Original Message-----
From: interest-bounces+scott.bloom=onshorecs....@qt-project.org 
[mailto:interest-bounces+scott.bloom=onshorecs....@qt-project.org] On Behalf Of 
Nikos Chantziaras
Sent: Saturday, August 18, 2012 1:44 PM
To: interest@qt-project.org
Subject: Re: [Interest] Double destruction of Qt objects in Qt example code?

On 18/08/12 23:21, André Pönitz wrote:
> On Sat, Aug 18, 2012 at 09:29:53PM +0300, Nikos Chantziaras wrote:
>>  [...]
>> On a similar note, don't delete QObject instances manually.  Call 
>> their
>> deleteLater() member function instead.
>
> There are only rare cases where deleteLater is needed.
> Otherwise, using it is unneeded overhead.

How much of an overhead?  I think it's preferable to trade a tiny bit of 
overhead for event propagation safety.  The event loop might not be finished 
with the object at the time of deletion.

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to