[Qt-interest] Crash in testAttribute_helper

Kustaa Nyholm Kustaa.Nyholm at planmeca.com
Wed Sep 22 12:03:55 CEST 2010


Hi List,

I've got a weird crash, attached is a valgrid capture of the crash.

This is 100% reproducible, but I've not been able to track
what is it that actually causes this. I suspect this is
something to do with my code (and not Qt per se) and
I've tried track dangling pointers etc with valgrin, but no
luck.

Googling reveals that there have been incidences/crashes that have
been manifested themselves as crashes in testAttribute_helper but
my take was that the actual problems is somewhere else.


What happens is that we have a custom menubar/popup menu, implemented
as one QWidget for the menubar and another that we instantiate and delete on
the fly for each popup menu. When the mouse moves the menus open and close
much like with the standard menubar. I can move the mouse in out of the
menus and they open and close and the widget gets created and deleted just
fine. But if I let the mouse go above the menubar widget then
the next time the mouse enters the menubar and a new menu pops up
the application crashes.


This is really weird because the same code paths get executed all
the time when the mouse moves (no clicking is involved), the only difference
I've been able to think of is that there must be some mouse enter/exit
events generated when the mouse moves above the menubar. But this has not
helped me as we do not process those events in any case.

I can't easily produce a test case I can share.

One more observation: if I comment out the line that deletes
the popup widget once we are through with it, the crashing behavior
changes, but it still often crashes at some later date.
 

All thoughts / comments wellcome.

Oh yes, this is Qt 4.7.0 on Mac OS X 10.6.4

br Kusti









==57358== Process terminating with default action of signal 11 (SIGSEGV)
==57358==  Access not within mapped region at address 0x8
==57358==    at 0x10049F6DE:
QWidget::testAttribute_helper(Qt::WidgetAttribute) const (in
/Library/Frameworks/QtGui.framework/Versions/4/QtGui)
==57358==    by 0x100402F15: -[QCocoaView mouseEntered:] (in
/Library/Frameworks/QtGui.framework/Versions/4/QtGui)
==57358==    by 0x10187DDC5: -[NSApplication sendEvent:] (in
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
==57358==    by 0x10040B809: -[QNSApplication sendEvent:] (in
/Library/Frameworks/QtGui.framework/Versions/4/QtGui)
==57358==    by 0x101814921: -[NSApplication run] (in
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
==57358==    by 0x100415483:
QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
(in /Library/Frameworks/QtGui.framework/Versions/4/QtGui)
==57358==    by 0x1012EEE53:
QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in
/Library/Frameworks/QtCore.framework/Versions/4/QtCore)
==57358==    by 0x1012EF173:
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in
/Library/Frameworks/QtCore.framework/Versions/4/QtCore)
==57358==    by 0x1012F079B: QCoreApplication::exec() (in
/Library/Frameworks/QtCore.framework/Versions/4/QtCore)
==57358==    by 0x1000033E3: main (in ./XXXXXXX)
==57358==  If you believe this happened as a result of a stack
==57358==  overflow in your program's main thread (unlikely but
==57358==  possible), you can try to increase the size of the
==57358==  main thread stack using the --main-stacksize= flag.
==57358==  The main thread stack size used in this run was 8388608.
==57358== 
==57358== HEAP SUMMARY:
==57358==     in use at exit: 35,206,822 bytes in 210,696 blocks
==57358==   total heap usage: 3,256,405 allocs, 3,045,709 frees, 469,800,049
bytes allocated


-- 





More information about the Qt-interest-old mailing list