[Marble-commits] KDE/kdeedu/marble/src/lib

Thibaut Gridel tgridel at free.fr
Fri Jul 16 23:09:53 CEST 2010


SVN commit 1150815 by tgridel:

FileManager takes over geodatadocument ownership

 M  +0 -1      FileLoader.cpp  
 M  +2 -1      FileManager.cpp  
 M  +8 -8      KmlFileViewItem.cpp  
 M  +2 -2      KmlFileViewItem.h  


--- trunk/KDE/kdeedu/marble/src/lib/FileLoader.cpp #1150814:1150815
@@ -44,7 +44,6 @@
 
 FileLoader::~FileLoader()
 {
-    delete m_document;
 }
 
 QString FileLoader::path() const
--- trunk/KDE/kdeedu/marble/src/lib/FileManager.cpp #1150814:1150815
@@ -156,6 +156,7 @@
             if ( geometryModel->geoDataRoot() == file->document() ) {
                 geometryModel->setGeoDataRoot( 0 );
             }
+            delete file->document();
         }
         delete d->m_fileItemList.at( index );
         d->m_fileItemList.removeAt( index );
@@ -177,7 +178,7 @@
 
 void FileManager::addGeoDataDocument( GeoDataDocument* document )
 {
-    KmlFileViewItem* item = new KmlFileViewItem( *this, *document );
+    KmlFileViewItem* item = new KmlFileViewItem( *this, document );
     addFile( item );
 
     // now get the document that will be preserved throughout the life time
--- trunk/KDE/kdeedu/marble/src/lib/KmlFileViewItem.cpp #1150814:1150815
@@ -15,7 +15,7 @@
 
 using namespace Marble;
 
-KmlFileViewItem::KmlFileViewItem( FileManager& manager, const GeoDataDocument& document ) :
+KmlFileViewItem::KmlFileViewItem( FileManager& manager, GeoDataDocument* document ) :
     m_fileManager( manager ),
     m_document( document )
 {
@@ -33,25 +33,25 @@
 
 GeoDataDocument* KmlFileViewItem::document()
 {
-    return &m_document;
+    return m_document;
 }
 
 bool KmlFileViewItem::isShown() const
 {
-    return m_document.isVisible();
+    return m_document->isVisible();
 }
 
 void KmlFileViewItem::setShown( bool value )
 {
-    m_document.setVisible( value );
+    m_document->setVisible( value );
 }
 
 QString KmlFileViewItem::name() const
 {
-    if(!m_document.name().isEmpty())
-        return m_document.name();
-    else if(!m_document.fileName().isEmpty())
-        return m_document.fileName();
+    if(!m_document->name().isEmpty())
+        return m_document->name();
+    else if(!m_document->fileName().isEmpty())
+        return m_document->fileName();
     else
         return QString("KML Document");
 
--- trunk/KDE/kdeedu/marble/src/lib/KmlFileViewItem.h #1150814:1150815
@@ -22,7 +22,7 @@
 class KmlFileViewItem : public AbstractFileViewItem
 {
   public:
-    KmlFileViewItem( FileManager &manager, const GeoDataDocument& document );
+    KmlFileViewItem( FileManager &manager, GeoDataDocument *document );
     ~KmlFileViewItem();
 
     /*
@@ -36,7 +36,7 @@
     GeoDataDocument* document();
   private:
     FileManager  &m_fileManager;
-    GeoDataDocument    m_document;
+    GeoDataDocument    *m_document;
 };
 
 }


More information about the Marble-commits mailing list