[Qt-interest] NewBie: How to trace Segmentation Fault in Qt?
Usman Ajmal
uzmanajmal at gmail.com
Mon Jul 20 12:16:07 CEST 2009
Thanks a lot guys. Segmentation problem removed.
I was not using isEmpty( ) to check whether the stack from which i was
poping items was empty; came to know about when used bt to backtrace.
Thanks again
On Mon, Jul 20, 2009 at 2:26 PM, Srdjan Todorovic <
todorovic.s at googlemail.com> wrote:
> 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
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090720/a51ab7e3/attachment.html
More information about the Qt-interest-old
mailing list