Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, April 2008
Crash in QApplication::topLevelWidgets()


Message 1 in thread

Hi,

I port my application from 3.3.8 to 4.3.4 on Windows XP with VS2005.
I use Qt3Support module. I've got very strange crash in  "QWidgetList 
QApplication::topLevelWidgets()"
when I call it inside my "customEvent(QEvent *evt)" method . I debug the 
Qt sources and see that one of the widget
in the widget list returned by "QApplication::allWidgets()" is a dead 
pointer(data=0xffffffff).

How it could happened that "allWidgets()" could possible contain a 
pointer to freed memory?
Did I miss something in Qt4 new widget life cycle strategy ?

Thanks,
Vladimir

--
 [ signature omitted ] 

Message 2 in thread

Hi,

> when I call it inside my "customEvent(QEvent *evt)" method . I debug the 
> Qt sources and see that one of the widget
> in the widget list returned by "QApplication::allWidgets()" is a dead 
> pointer(data=0xffffffff).

It could be a bug in Qt, or a memory bug in the application. It's hard to tell 
without a small compilable example that reproduces the problem.

-- 
 [ signature omitted ] 

Message 3 in thread

Is it possible that the widget is deleted yet the event loop has not
been run yet?

Since many widget deletes when not done explicitly, are done via a
deleteLater, it is possible that your getting the system in an
indeterminate state.

While I would nto recommend production code using this, you might want
to try and run

QApplication::processEvents(QEventLoop::ExcludeUserInputEvents ) 

To see if the object deleted signals get processed first

Scott
> -----Original Message-----
> From: Vladimir Romanovskiy [mailto:3504-214@xxxxxxxxx]
> Sent: Tuesday, April 08, 2008 2:24 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Crash in QApplication::topLevelWidgets()
> 
> Hi,
> 
> I port my application from 3.3.8 to 4.3.4 on Windows XP with VS2005.
> I use Qt3Support module. I've got very strange crash in  "QWidgetList
> QApplication::topLevelWidgets()"
> when I call it inside my "customEvent(QEvent *evt)" method . I debug
> the
> Qt sources and see that one of the widget
> in the widget list returned by "QApplication::allWidgets()" is a dead
> pointer(data=0xffffffff).
> 
> How it could happened that "allWidgets()" could possible contain a
> pointer to freed memory?
> Did I miss something in Qt4 new widget life cycle strategy ?
> 
> Thanks,
> Vladimir
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ]