[Qt-interest] NewBie: How to trace Segmentation Fault in Qt?
Srdjan Todorovic
todorovic.s at googlemail.com
Mon Jul 20 11:26:49 CEST 2009
Hi,
On 20/07/2009, Usman Ajmal <uzmanajmal at gmail.com> wrote:
> ok i got following message after running my buggy program using gdb:
>
> (gdb) run
> Starting program: /home/usman/Memviz/QT/AnalysisModule/AnalysisModule
> [Thread debugging using libthread_db enabled]
> [New Thread 0xb6da96d0 (LWP 9320)]
> Aspect Ratio:3.02857 Aspect Ratio:1.32075
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb6da96d0 (LWP 9320)]
> QGraphicsItem::scene (this=0x80f9930) at graphicsview/qgraphicsitem.cpp:839
> 839 QGraphicsScene *QGraphicsItem::scene() const
Just after you do this, can you please type in 'bt' and press return?
This will give you a stack trace and is often very useful for
debugging segmentation faults.
> sqMap *square;
> QStack <sqMap *> sqrBasket;
> for(int j=0; j<=10; j++)
> {
> square = new sqMap(tempWidth, tempHeight);
> square->setPos(xLocation,yLocation);
> sqrBasket.push(square);
> scene->addItem(square);
I am going to guess... that scene is not initialised correctly.
Srdjan
More information about the Qt-interest-old
mailing list