[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/marble/src/plugins/render
From:       Andrew Manson <g.real.ate () gmail ! com>
Date:       2009-07-20 16:35:16
Message-ID: 1248107716.323736.27166.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 999946 by mansona:

committing test case to catch the stack item bug in action. 
Loading OSM files will crash marble with this commit 



 M  +1 -1      CMakeLists.txt  
 M  +20 -1     osmannotate/osm/OsmNdTagHandler.cpp  
 M  +4 -2      osmannotate/osm/OsmWayTagHandler.cpp  


--- trunk/KDE/kdeedu/marble/src/plugins/render/CMakeLists.txt #999945:999946
@@ -13,7 +13,7 @@
 # add_subdirectory ( twitter )
 add_subdirectory( wikipedia )
 add_subdirectory( weather )
-# add_subdirectory( osmannotate )
+add_subdirectory( osmannotate )
 
 add_subdirectory( navigation )
 # add_subdirectory ( FITemplate )
--- trunk/KDE/kdeedu/marble/src/plugins/render/osmannotate/osm/OsmNdTagHandler.cpp #999945:999946
@@ -13,6 +13,8 @@
 #include "OsmNdTagHandler.h"
 #include "OsmWayGraphicsItem.h"
 
+#include <QtCore/QDebug>
+
 namespace Marble
 {
 namespace osm
@@ -28,10 +30,27 @@
 
     GeoStackItem parent = parser.parentElement();
 
+    //FIXME: problem with the stack implementation
+
+    //this should be "way"
+    qDebug() << Q_FUNC_INFO;
+    qDebug() << "parent element name:" << parent.first.first;
+    Q_ASSERT( parent.first.first.compare("way") == 0 );
+
+    //this should be set because we know that the containing
+    // <way> element did not return 0
+    qDebug() << " parent associated node pointer:" << parent.associatedNode();
+
+    Q_ASSERT( parent.associatedNode() );
+
     GeoNode* wayNode = parent.associatedNode();
 
-    OsmWayGraphicsItem* way = (OsmWayGraphicsItem*)wayNode;
+    QString n = parser.name().toString();
 
+    OsmWayGraphicsItem* way = reinterpret_cast<OsmWayGraphicsItem*>(wayNode);
+
+    Q_ASSERT( way );
+
     //the line that crashes
 //    way->addNodeReferenceId( parser.attribute("ref").toInt() );
 
--- trunk/KDE/kdeedu/marble/src/plugins/render/osmannotate/osm/OsmWayTagHandler.cpp #999945:999946
@@ -26,9 +26,11 @@
 
 GeoNode* OsmWayTagHandler::parse( GeoParser& parser ) const
 {
+    GeoNode* result;
     OsmWayGraphicsItem* way = new OsmWayGraphicsItem();
-    qDebug() << ((GeoNode*)(way));
-    return ((GeoNode*)(way));
+    result = reinterpret_cast<GeoNode*>(way);
+    Q_ASSERT( result );
+    return result;
 }
 
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic