Results 1 to 8 of 8

Thread: Segmentation fault whilst running QtLocation app

  1. #1
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Segmentation fault whilst running QtLocation app

    Hi Guys,
    I'm trying to run a very basic QtLocation application. It contains only a QGraphicsView widget and I want to add a QGraphicsGeoMap item to this view's scene. The code compiles without errors but when I try to run the app I immediately get a segmentation fault.

    Here's the code:
    Qt Code:
    1. ui->setupUi(this);
    2. QGraphicsScene *mapScene = new QGraphicsScene(this);
    3. ui->graphicsView->setScene(mapScene);
    4. ui->graphicsView->setInteractive(true);
    5.  
    6. QGeoServiceProvider serviceProvider("nokia");
    7. QGeoMappingManager *manager = serviceProvider.mappingManager();
    8. QGraphicsGeoMap *geoMap = new QGraphicsGeoMap(manager);
    9. ui->graphicsView->scene()->addItem(geoMap);
    To copy to clipboard, switch view to plain text mode 

    Here's the error:
    Qt Code:
    1. Dump of assembler code for function ZNK10QtMobility29QGeoTiledMappingManagerEngine8tileSizeEv:
    2. 0x67022f08 <+0>: push %ebp
    3. 0x67022f09 <+1>: mov %esp,%ebp
    4. 0x67022f0b <+3>: mov 0x8(%ebp),%eax
    5. 0x67022f0e <+6>: mov 0x8(%eax),%eax
    6. 0x67022f11 <+9>: mov 0x30(%eax),%edx
    7. 0x67022f14 <+12>: mov 0x2c(%eax),%eax
    8. 0x67022f17 <+15>: leave
    9. 0x67022f18 <+16>: ret
    10. 0x67022f19 <+17>: nop
    11. 0x67022f1a <+18>: xchg %ax,%ax
    12. End of assembler dump.
    To copy to clipboard, switch view to plain text mode 

    Last stack entries:
    Qt Code:
    1. 0 ZNK10QtMobility29QGeoTiledMappingManagerEngine8tileSizeEv C:\QtMobility\lib\QtLocation1.dll 0 0x67022f11
    2. 1 ZNK10QtMobility16QGeoTiledMapData22mapObjectsInScreenRectERK6QRectF C:\QtMobility\lib\QtLocation1.dll 0 0x6701bb77
    3. 2 ZN10QtMobility16QGeoTiledMapData8paintMapEP8QPainterPK24QStyleOptionGraphicsItem C:\QtMobility\lib\QtLocation1.dll 0 0x6701d26d
    4. 3 ZN10QtMobility15QGraphicsGeoMap11resizeEventEP25QGraphicsSceneResizeEvent C:\QtMobility\lib\QtLocation1.dll 0 0x670392be
    5. 4 ZN15QGraphicsWidget5eventEP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6568af3f
    6. 5 ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6510fa38
    7. 6 ZN12QApplication6notifyEP7QObjectP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6511825b
    8. 7 ZN16QCoreApplication14notifyInternalEP7QObjectP6QEvent C:\Qt\4.7.1\bin\QtCore4.dll 0 0x6a2b28f4
    9. 8 ZN15QGraphicsWidget11setGeometryERK6QRectF C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6568dbe8
    10. 9 ZN15QGraphicsWidget6resizeERK6QSizeF C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6568ba76
    11. 10 ZN15QGraphicsWidget10adjustSizeEv C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6568bbdf
    12. 11 ZN15QGraphicsWidget10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6568d11c
    13. 12 ZN14QGraphicsScene12setSceneRectERK6QRectF C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6565f800
    14. 13 ZN14QGraphicsScene9drawItemsEP8QPainteriPP13QGraphicsItemPK24QStyleOptionGraphicsItemP7QWidget C:\Qt\4.7.1\bin\QtGui4.dll 0 0x65666a10
    15. 14 ZN13QGraphicsView10paintEventEP11QPaintEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x65687590
    16. 15 ZN7QWidget5eventEP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x651599ad
    17. 16 ZN6QFrame5eventEP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x654901d9
    18. 17 ZN13QGraphicsView13viewportEventEP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x65684100
    19. 18 ZN23QCoreApplicationPrivate29sendThroughObjectEventFiltersEP7QObjectP6QEvent C:\Qt\4.7.1\bin\QtCore4.dll 0 0x6a2b2013
    20. 19 ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6510fa1b
    21. 20 ZN12QApplication6notifyEP7QObjectP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x651182f2
    To copy to clipboard, switch view to plain text mode 

    I'm running Qt 4.7.1, QtMobility 1.1.0 and QtCreator 2.0.1 under Win 7.
    I'd really appreciate any ideas how to solve this problem.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Segmentation fault whilst running QtLocation app

    This dump doesn't help much, since if you have some bad pointer in your code, it could crash somewhere in Qt when it tries to use it.
    On which line in YOUR code does it crash?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Segmentation fault whilst running QtLocation app

    Application crashes during QApplication::exec():

    Qt Code:
    1. QApplication a(argc, argv);
    2. PlannerView w;
    3. w.show();
    4.  
    5. return a.exec(); // this line
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Segmentation fault whilst running QtLocation app

    Sorry for double posting but maybe it will help if I tell you that examples provided by Qt (including the mapviewer example) are working on my laptop. They use different header files though (those included in the mobility archive).

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Segmentation fault whilst running QtLocation app

    Please provide a minimal compilable example reproducing the problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Segmentation fault whilst running QtLocation app

    You can find the example in the attached archive. You have to change the INCLUDEPATH variable in the .pro file but I'm sure you know that.
    Attached Files Attached Files
    Last edited by Ereb; 8th December 2010 at 22:25.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Segmentation fault whilst running QtLocation app

    Your QGeoServiceProvider object goes out of scope and when it is destroyed, it invalidates all objects using its services. Create the object on heap instead or make sure it persists through the whole lifetime of your application.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. The following user says thank you to wysota for this useful post:

    Ereb (9th December 2010)

  9. #8
    Join Date
    Dec 2010
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Segmentation fault whilst running QtLocation app

    That solved the problem, thanks.

Similar Threads

  1. segmentation fault!!
    By Yayati.Ekbote in forum Qt Programming
    Replies: 4
    Last Post: 24th March 2010, 15:10
  2. Segmentation fault
    By impeteperry in forum Qt Programming
    Replies: 5
    Last Post: 29th December 2008, 18:59
  3. Segmentation Fault?!
    By r07f1 in forum Newbie
    Replies: 2
    Last Post: 11th April 2008, 15:10
  4. segmentation fault
    By mattia in forum Newbie
    Replies: 22
    Last Post: 7th November 2007, 10:37
  5. Segmentation fault running any QT4 executables
    By jellis in forum Installation and Deployment
    Replies: 7
    Last Post: 19th May 2007, 16:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.