Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#727 closed defect (fixed)

[BUG] Crash when opening gpx files

Reported by: dantje Owned by: Chris Browet
Priority: minor Milestone:
Component: merkaartor Version:
Keywords: Cc: Chris Browet



  1. Start Merkaator
  2. File/Open? <somefile.gpx>

The backtrace is not directly helpful:

(gdb) bt
#0  0xb78c0790 in ?? () from /usr/lib/
#1  0xbf993b28 in ?? ()
#2  0xb799606f in QPainter::drawText () from /usr/lib/
Backtrace stopped: frame did not save the PC

The code visits LayerManger::backZoomIn() twice. The second time around it calls ImageManager::instance()->abortLoading() and segfaults.

Attachments (1)

82320.gpx (141.9 KB) - added by dantje 12 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 12 years ago by bart@…

The backtrace in Visual Studio is a bit more clear, although I have not fully studied the issue. There seems to be a mishandling in the layerwidgets. Maybe Chris can find out what the problem is?

comment:2 Changed 12 years ago by bart@…

Also, if you import a GPX file, merkaartor doesn't crash but you end up with two background image layers. I suppose that one is related.

comment:3 Changed 12 years ago by dantje

I ran this in valgrind and it did not crash. Duh. Heisenbug.

comment:4 Changed 12 years ago by dantje

I stepped thru this until I found the last instruction before the crash. It is in the the loadingFinished signal emit. I saved the backtrace before and after.

ImageManager::abortLoading (this=0x8198538) at QMapControl/imagemanager.cpp:93
93              loadingQueueEmpty();
(gdb) s
ImageManager::loadingQueueEmpty (this=0x8198538) at QMapControl/imagemanager.cpp:84
84              emit(loadingFinished());
(gdb) s
ImageManager::loadingFinished (this=0x8198538) at GeneratedFiles/debug/moc_imagemanager.cpp:91
91          QMetaObject::activate(this, &staticMetaObject, 2, 0);
(gdb) bt
#0  ImageManager::loadingFinished (this=0x8198538) at GeneratedFiles/debug/moc_imagemanager.cpp:91
#1  0x080dea75 in ImageManager::loadingQueueEmpty (this=0x8198538) at QMapControl/imagemanager.cpp:84
#2  0x080dea97 in ImageManager::abortLoading (this=0x8198538) at QMapControl/imagemanager.cpp:93
#3  0x080e23c0 in LayerManager::backZoomIn (this=0x86f55d8) at QMapControl/layermanager.cpp:275
#4  0x080e2e1d in LayerManager::setView (this=0x86f55d8, coordinates=@0xbfae638c) at QMapControl/layermanager.cpp:145
#5  0x0807a0c0 in Projection::layerManagerSetViewport (this=0x818604c, TargetMap=@0xbfae6460, Screen=@0xbfae6480) at Map/Projection.cpp:186
#6  0x0807a184 in Projection::setViewport (this=0x818604c, TargetMap=@0xbfae6460, Screen=@0xbfae6480) at Map/Projection.cpp:115
#7  0x080b5453 in MainWindow::on_viewZoomAllAction_triggered (this=0xbfae79b4) at MainWindow.cpp:307
#8  0x080b3b08 in MainWindow::on_fileOpenAction_triggered (this=0xbfae79b4) at MainWindow.cpp:266
#9  0x080f1c89 in MainWindow::qt_metacall (this=0xbfae79b4, _c=QMetaObject::InvokeMetaMethod, _id=20, _a=0xbfae6adc)
    at GeneratedFiles/debug/moc_MainWindow.cpp:164
#10 0xb763ac04 in QMetaObject::activate () from /usr/lib/
#11 0xb763ae00 in QMetaObject::activate () from /usr/lib/
#12 0xb786c878 in QAction::triggered () from /usr/lib/
#13 0xb786e5e6 in QAction::activate () from /usr/lib/
#14 0xb7c59abf in ?? () from /usr/lib/
#15 0x0815efb8 in ?? ()
#16 0x00000000 in ?? ()
(gdb) p $pc
$5 = (void (*)(void)) 0x80f35dc <ImageManager::loadingFinished()+6>
(gdb) p $sp
$6 = (void *) 0xbfae6210
(gdb) p this
$7 = (ImageManager * const) 0x8198538
(gdb) p staticMetaObject 
$8 = {d = {superdata = 0x812de80, stringdata = 0x80fdf60 "ImageManager", data = 0x80fdfc0, extradata = 0x0}}
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0xb789c790 in ?? () from /usr/lib/
(gdb) bt
#0  0xb789c790 in ?? () from /usr/lib/
#1  0xbfae45e8 in ?? ()
#2  0xb797206f in QPainter::drawText () from /usr/lib/
Backtrace stopped: frame did not save the PC
(gdb) p $pc
$9 = (void (*)(void)) 0xb789c790 <_fini+6373292>
(gdb) p $sp
$10 = (void *) 0xbfae4538

comment:5 Changed 12 years ago by Chris Browet

Owner: changed from bvh-osm@… to Chris Browet
Status: newassigned

comment:6 Changed 12 years ago by Chris Browet

I must say I don't get any of your problems with my development version on linux. This version should be no different than the one in svn regarding this, but I'll anyway test with the svn version.

Just to be aligned, could you both attach your problematic GPX, just in case it's file dependent.

comment:7 Changed 12 years ago by Chris Browet

Also, could you specify which image backend you were using and your Qt version (I'm using 4.3.3)

Changed 12 years ago by dantje

Attachment: 82320.gpx added

comment:8 Changed 12 years ago by dantje

I see the same behaviour in a fresh checkout from svn. Qt revision is 4.3.2 on Ubuntu 7.10 (gutsy). It does not seem to be related to the gpx file, but I'll attach a "bad" file that I just got from the traces list.

Image backend is the background image layer? I use the OSM one. But if I check "None" it also happens.

I can make the file/open work by commenting out the Layout->addWidget(w) line from theLayerDock::updateContent() method.

comment:9 Changed 12 years ago by Chris Browet

Definitely cannot reproduce on my gentoo. Will check on monday on win32 (also 4.3.3 unfortunately).

I suspect a qt bug which was corrected on 4.3.3, so I'll install a virtual ubuntu 7.10 machine to try to reproduce.

comment:10 Changed 12 years ago by Chris Browet

I confirm I get the crash on Ubuntu 7.10/Qt 4.3.2. Debugging...

comment:11 Changed 12 years ago by Chris Browet

Resolution: fixed
Status: assignedclosed

LayerWidgets? are reparented to the groupbox, so leave to it to delete them. The crash on qt 4.3.2 seems to come from an additional repaint of the widget on an already deleted layer. Fixed in [7067]

comment:12 Changed 12 years ago by Chris Browet

(In [7068]) ADD : Export viewport to OSM FIX : LayerWidget? destruction (should fix #727, and not 731) FIX : Update layer list on download FIX : do not create undo list on track open

Note: See TracTickets for help on using tickets.