Bug 202781 - KMLTest Crashes with segfault on GeoDataGeometry::detach
Summary: KMLTest Crashes with segfault on GeoDataGeometry::detach
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Unspecified
: NOR crash
Target Milestone: 0.8 (KDE 4.3)
Assignee: marble-bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-06 12:06 UTC by Andrew Manson
Modified: 2013-10-20 08:02 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Manson 2009-08-06 12:06:18 UTC
Version:            (using Devel)
Installed from:    Compiled sources

The KMLTest ( marble_build_dir/tests/KMLTest ) is currently failing because of a segfault in the GeoDataGeometry::detach method. 
I'm including the backtrace inline: 
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb583d9e0 (LWP 15073)]        
Marble::GeoDataGeometry::detach (this=0x89401a0) at /usr/include/qt4/QtCore/qbasicatomic.h:64
64              return _q_value == value;                                                    
(gdb) bt                                                                                     
#0  Marble::GeoDataGeometry::detach (this=0x89401a0) at /usr/include/qt4/QtCore/qbasicatomic.h:64
#1  0xb7224cc2 in Marble::GeoDataLineString::begin (this=0x89401a0) at /media/stuff/dev/marble/src/lib/geodata/data/GeoDataLineString.cpp:192
#2  0x0804bf3d in Marble::KMLTest::loadKMLFromCache (this=0xbff6dac4) at /media/stuff/dev/marble/tests/KMLTest.cpp:152                       
#3  0x0804cee8 in Marble::KMLTest::qt_metacall (this=0xbff6dac4, _c=QMetaObject::InvokeMetaMethod, _id=143917472, _a=0xbff6cfd8)             
    at /media/stuff/dev/marble_qtcreator-build/tests/KMLTest.moc:76                                                                          
#4  0xb7f4a7a9 in QMetaMethod::invoke () from /usr/lib/libQtCore.so.4                                                                        
#5  0xb7f4af2f in QMetaObject::invokeMethod () from /usr/lib/libQtCore.so.4                                                                  
#6  0xb73f1477 in ?? () from /usr/lib/libQtTest.so.4                                                                                         
#7  0xb73f22dc in ?? () from /usr/lib/libQtTest.so.4                                                                                         
#8  0xb73f2673 in QTest::qExec () from /usr/lib/libQtTest.so.4                                                                               
#9  0x0804a8e9 in main (argc=1, argv=0xbff6db84) at /media/stuff/dev/marble/tests/KMLTest.cpp:212
Comment 1 Dennis Nienhüser 2010-01-16 01:36:59 UTC
detach fails because the static_cast done above is invalid: It expects a Polygon, but it gets a Point (or rather garbage). This in turn happens because pack() of the Placemark is not called correctly during save: Only pack() of GeoDataFeature is called, not pack() of GeodataPlacemark() for some reason. Therefore too little data is written to the stream, which results in garbage being read later. Needs to be tracked down further.