Qt4-preview-feedback Archive, March 2008
Re: Problems with deferred deletion of objects in 4.4 beta
Message 1 in thread
There is another problem in the same domain:
My application calls:
QCoreApplication::processEvents();
In one of the processed events (custom event A), a new custom event B is
posted.
In Qt 4.3: processEvents() would return after also processing the event B.
In Qt 4.4: processEvents() has to be called one more time to have B
processed.
Bug or new design?
Philippe
On Fri, 29 Feb 2008 10:26:35 +0100
Bradley T Hughes <bhughes@xxxxxxxxxxxxx> wrote:
> Joe Newman wrote:
> > We're seeing significant memory leaks with 4.4 beta, and I
> > think I've found the reason why.
> [snip]
> >
> > Does this mean we no longer need to clean up when our application shuts
> > down by calling qApp->processEvents(QEventLoop::DeferredDeletion)?
>
> DeferredDelete event handling has been improved to the point where most manual
> deliver of such events is unnecessary[1]. As such, the DeferredDeletion
> processEvents() flag has been deprecated and doesn't work anymore in 4.4. In
> addition, it's just another way of calling sendPostedEvents(0,
> QEvent::DeferredDelete); However, a gratuitous change like that isn't
> necessarily a good thing. I'll fix it so that the flag continues to work.
>
> [1] However, if you call deleteLater() on many objects after the event loop
> has been stopped, it's still necessary to manual clean them up (as you
> apparently do).
>
> > If so, why are we getting so many leaked objects with 4.4 beta? Shouldn't they
> > get cleaned up automatically if they've been flagged for deferred
> > deletion?
>
> If you replace qApp->processEvents(QEventLoop::DeferredDeletion) with
> QApplication::sendPostedEvents(0, QEvent::DeferredDelete), does the leak go
> away? If so, my revert of the QEventLoop::DeferredDeletion crippling will fix
> your problem.
>
> --
> Bradley T. Hughes - bhughes at trolltech.com
> Trolltech ASA - Sandakervn. 116, P.O. Box 4332 Nydalen, 0402 Oslo, Norway
>
>
> To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
Message 2 in thread
Philippe wrote:
> There is another problem in the same domain:
>
> My application calls:
>
> QCoreApplication::processEvents();
>
> In one of the processed events (custom event A), a new custom event B is
> posted.
>
> In Qt 4.3: processEvents() would return after also processing the event B.
>
> In Qt 4.4: processEvents() has to be called one more time to have B
> processed.
>
> Bug or new design?
Based on what you describe though, this is the intended behavior (in fact, Qt
has behaved like this since 4.0.0). If you have an example that reproduces
your problem, I'd certainly like to see it.
--
[ signature omitted ]