[Qt-interest] Program Crash on exit inside ~QObjectPrivate at kernel/qobject.cpp:167

Josiah Bryan jbryan at productiveconcepts.com
Thu Sep 10 16:01:45 CEST 2009


Thiago Macieira wrote:
> Em Quarta-feira 9. Setembro 2009, às 18.38.16, Josiah Bryan escreveu:
>> I don't know what exactly to say - other than, I've got a qgraphicsscene
>> with one or two custom items (no other items.) Works fine, no leaks,
>> everything seems normal. As soon as I close the program, it crashes
>> without exiting cleanly. Now, all my code finishes, but the program
>> still crashes before returning to the OS.
>>
>> Full Disclosure: The single odd thing I know that I do is this: Compile
>> & link with Qt 4.5, run against Qt 4.6. (No reason not to compile with
>> 4.6, except I want to maintain compat with 4.5 for now since I use
>> QtCreator 4.5 to build on windows and 4.6 isn't available yet for
>> windows (other than the techpreview this morning.)) I run against 4.6 on
>> linux because the video widget I use crashes X windows in 4.5, but runs
>> fine in 4.6.
> [snip]
> 
>> Any throughts or ideas on how to troubleshoot this darn thing?
> 
> Hi Josiah
> 
> Your description doesn't give us much of a hint. It's basically telling us 
> that there's a memory error somewhere, either in Qt or in your program. We 
> can't do much more than that.
> 
> The traces you posted indicate that it's either a double delete or an invalid 
> pointer. And they also indicate you're running Linux, which makes my 
> suggestion much easier:
> 
> valgrind your application.
> 
> Valgrind will tell you what the exact memory error was. If the pointer was 
> already deleted, it'll tell you where it was first deleted. If it's just a 
> fuzzy pointer (near an existing memory allocation), it'll tell you that. Or it 
> may also tell you it's a completely invalid content, which generally indicates 
> buffer overrun or uninitialised data.
> 

Thanks for the hint to use valgrind - didnt find anything that I can 
fix, but it gave some fun error messages. Here's the two blocks right 
around the SIGSEGV. Attached is the FULL valgrind output for the run of 
that program (valgrind --tool=memcheck --leak=check=full).


==2994== Invalid read of size 1
==2994==    at 0x491A38E: QGraphicsItem::~QGraphicsItem() 
(qgraphicsitem.cpp:1213)
==2994==    by 0x47CBFA1: void 
qDeleteAll<QList<QGraphicsItem*>::const_iterator>(QList<QGraphicsItem*>::const_iterator, 
QList<QGraphicsItem*>::const_iterator) (qalgorithms.h:333)
==2994==    by 0x493991E: QGraphicsScene::clear() (qalgorithms.h:341)
==2994==    by 0x4939B51: QGraphicsScene::~QGraphicsScene() 
(qgraphicsscene.cpp:1343)
==2994==    by 0x8060092: MyGraphicsScene::~MyGraphicsScene() 
(MyGraphicsScene.cpp:43)
==2994==    by 0x4E77630: QObjectPrivate::deleteChildren() 
(qobject.cpp:1980)
==2994==    by 0x43227DF: QWidget::~QWidget() (qwidget.cpp:1471)
==2994==    by 0x47233B0: QMainWindow::~QMainWindow() (qmainwindow.cpp:329)
==2994==    by 0x805E6D4: MainWindow::~MainWindow() (MainWindow.cpp:447)
==2994==    by 0x8063778: main (main.cpp:125)
==2994==  Address 0xF6 is not stack'd, malloc'd or (recently) free'd
==2994==


==2994== Process terminating with default action of signal 11 (SIGSEGV)


==2994==  Access not within mapped region at address 0xF6
==2994==    at 0x491A38E: QGraphicsItem::~QGraphicsItem() 
(qgraphicsitem.cpp:1213)
==2994==    by 0x47CBFA1: void 
qDeleteAll<QList<QGraphicsItem*>::const_iterator>(QList<QGraphicsItem*>::const_iterator, 
QList<QGraphicsItem*>::const_iterator) (qalgorithms.h:333)
==2994==    by 0x493991E: QGraphicsScene::clear() (qalgorithms.h:341)
==2994==    by 0x4939B51: QGraphicsScene::~QGraphicsScene() 
(qgraphicsscene.cpp:1343)
==2994==    by 0x8060092: MyGraphicsScene::~MyGraphicsScene() 
(MyGraphicsScene.cpp:43)
==2994==    by 0x4E77630: QObjectPrivate::deleteChildren() 
(qobject.cpp:1980)
==2994==    by 0x43227DF: QWidget::~QWidget() (qwidget.cpp:1471)
==2994==    by 0x47233B0: QMainWindow::~QMainWindow() (qmainwindow.cpp:329)
==2994==    by 0x805E6D4: MainWindow::~MainWindow() (MainWindow.cpp:447)
==2994==    by 0x8063778: main (main.cpp:125)


 > In any case, if you can post a code sample showing how to reproduce 
the error,
 > we can help you more.

If you're willing, you can checkout the trunk at:

svn checkout http://dviz.googlecode.com/svn/trunk/ dviz-read-only

This crash is repeatable with revision 17, the latest at this moment. My 
system is running FC 8, uname -a reports:

Linux josiah-desktop.pci.local 2.6.23.9-85.fc8 #1 SMP Fri Dec 7 15:49:59 
EST 2007 i686 i686 i386 GNU/Linux

Please do note - I'm more than willing to admit its the fault of my code 
somewhere - I just don't know how to figure out *what* in my code is 
causing the fault.  Thanks!

Thanks for your time in this matter.

-josiah
-- 

-=-=-=-=-=-=-=-=-=-=-=-=-
Josiah Bryan
Productive Concepts, Inc.
jbryan at pciint.com
(765) 964-6009, ext. 224
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: val.txt
Url: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090910/a97412f9/attachment.txt 


More information about the Qt-interest-old mailing list