PDA

View Full Version : Segmentation fault whilst running QtLocation app



Ereb
2nd December 2010, 12:21
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:

ui->setupUi(this);
QGraphicsScene *mapScene = new QGraphicsScene(this);
ui->graphicsView->setScene(mapScene);
ui->graphicsView->setInteractive(true);

QGeoServiceProvider serviceProvider("nokia");
QGeoMappingManager *manager = serviceProvider.mappingManager();
QGraphicsGeoMap *geoMap = new QGraphicsGeoMap(manager);
ui->graphicsView->scene()->addItem(geoMap);

Here's the error:

Dump of assembler code for function ZNK10QtMobility29QGeoTiledMappingManagerEngine8til eSizeEv:
0x67022f08 <+0>: push %ebp
0x67022f09 <+1>: mov %esp,%ebp
0x67022f0b <+3>: mov 0x8(%ebp),%eax
0x67022f0e <+6>: mov 0x8(%eax),%eax
0x67022f11 <+9>: mov 0x30(%eax),%edx
0x67022f14 <+12>: mov 0x2c(%eax),%eax
0x67022f17 <+15>: leave
0x67022f18 <+16>: ret
0x67022f19 <+17>: nop
0x67022f1a <+18>: xchg %ax,%ax
End of assembler dump.

Last stack entries:


0 ZNK10QtMobility29QGeoTiledMappingManagerEngine8til eSizeEv C:\QtMobility\lib\QtLocation1.dll 0 0x67022f11
1 ZNK10QtMobility16QGeoTiledMapData22mapObjectsInScr eenRectERK6QRectF C:\QtMobility\lib\QtLocation1.dll 0 0x6701bb77
2 ZN10QtMobility16QGeoTiledMapData8paintMapEP8QPaint erPK24QStyleOptionGraphicsItem C:\QtMobility\lib\QtLocation1.dll 0 0x6701d26d
3 ZN10QtMobility15QGraphicsGeoMap11resizeEventEP25QG raphicsSceneResizeEvent C:\QtMobility\lib\QtLocation1.dll 0 0x670392be
4 ZN15QGraphicsWidget5eventEP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6568af3f
5 ZN19QApplicationPrivate13notify_helperEP7QObjectP6 QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6510fa38
6 ZN12QApplication6notifyEP7QObjectP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6511825b
7 ZN16QCoreApplication14notifyInternalEP7QObjectP6QE vent C:\Qt\4.7.1\bin\QtCore4.dll 0 0x6a2b28f4
8 ZN15QGraphicsWidget11setGeometryERK6QRectF C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6568dbe8
9 ZN15QGraphicsWidget6resizeERK6QSizeF C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6568ba76
10 ZN15QGraphicsWidget10adjustSizeEv C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6568bbdf
11 ZN15QGraphicsWidget10itemChangeEN13QGraphicsItem18 GraphicsItemChangeERK8QVariant C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6568d11c
12 ZN14QGraphicsScene12setSceneRectERK6QRectF C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6565f800
13 ZN14QGraphicsScene9drawItemsEP8QPainteriPP13QGraph icsItemPK24QStyleOptionGraphicsItemP7QWidget C:\Qt\4.7.1\bin\QtGui4.dll 0 0x65666a10
14 ZN13QGraphicsView10paintEventEP11QPaintEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x65687590
15 ZN7QWidget5eventEP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x651599ad
16 ZN6QFrame5eventEP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x654901d9
17 ZN13QGraphicsView13viewportEventEP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x65684100
18 ZN23QCoreApplicationPrivate29sendThroughObjectEven tFiltersEP7QObjectP6QEvent C:\Qt\4.7.1\bin\QtCore4.dll 0 0x6a2b2013
19 ZN19QApplicationPrivate13notify_helperEP7QObjectP6 QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x6510fa1b
20 ZN12QApplication6notifyEP7QObjectP6QEvent C:\Qt\4.7.1\bin\QtGui4.dll 0 0x651182f2


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.

high_flyer
2nd December 2010, 12:54
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?

Ereb
2nd December 2010, 13:12
Application crashes during QApplication::exec():


QApplication a(argc, argv);
PlannerView w;
w.show();

return a.exec(); // this line

Ereb
2nd December 2010, 16:33
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).

wysota
8th December 2010, 19:16
Please provide a minimal compilable example reproducing the problem.

Ereb
8th December 2010, 22:19
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.

wysota
9th December 2010, 00:52
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.

Ereb
9th December 2010, 10:32
That solved the problem, thanks.