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

List:       kde-commits
Subject:    branches/KDE/4.3/kdeedu/marble/src/lib
From:       Andrew Manson <g.real.ate () gmail ! com>
Date:       2009-07-20 23:56:37
Message-ID: 1248134197.381855.13285.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1000182 by mansona:

fixed a crash when a gpx file is loaded and the map view is changed. 
also closed a big memory leak. 


 M  +2 -0      AbstractLayer/AbstractLayer.h  
 M  +6 -6      MarbleModel.cpp  
 M  +7 -0      gps/GpsLayer.cpp  
 M  +3 -0      gps/GpsLayer.h  


--- branches/KDE/4.3/kdeedu/marble/src/lib/AbstractLayer/AbstractLayer.h #1000181:1000182
@@ -71,6 +71,8 @@
      */
     void setVisible( bool visible );
 
+    virtual void clearModel() = 0;
+
  public:
     /**
      * @brief Construct this layer with a parent
--- branches/KDE/4.3/kdeedu/marble/src/lib/MarbleModel.cpp #1000181:1000182
@@ -199,18 +199,18 @@
     connect( d->m_placemarkmodel,           SIGNAL( layoutChanged() ),
              d->m_placemarkLayout,          SLOT( requestStyleReset() ) );
 
-    d->m_gpxFileModel = new GpxFileModel( this );
-    d->m_gpsLayer = new GpsLayer( d->m_gpxFileModel );
-
-    connect( d->m_gpxFileModel, SIGNAL( modelChanged() ),
-             this,              SIGNAL( modelChanged() ) );
-
     /*
      * Create FileViewModel
      */
     connect( fileViewModel(), SIGNAL( modelChanged() ),
              this,            SIGNAL( modelChanged() ) );
 
+    d->m_gpxFileModel = new GpxFileModel( this );
+    d->m_gpsLayer = new GpsLayer( d->m_gpxFileModel );
+
+    connect( fileViewModel(), SIGNAL(layoutChanged()),
+             d->m_gpsLayer, SLOT(clearModel() ) );
+
     d->m_dateTime       = new ExtDateTime();
     /* Assume we are dealing with the earth */
     d->m_planet = new Planet( "earth" );
--- branches/KDE/4.3/kdeedu/marble/src/lib/gps/GpsLayer.cpp #1000181:1000182
@@ -110,3 +110,10 @@
 {
     m_fileModel->addFile( file );
 }
+
+void GpsLayer::clearModel()
+{
+    delete m_fileModel;
+    m_fileModel = 0;
+    m_fileModel = new GpxFileModel();
+}
--- branches/KDE/4.3/kdeedu/marble/src/lib/gps/GpsLayer.h #1000181:1000182
@@ -27,6 +27,7 @@
 
 class GpsLayer : public AbstractLayer
 {
+
  public:
     explicit GpsLayer( GpxFileModel *fileModel, QObject *parent =0 );
     ~GpsLayer();
@@ -47,6 +48,8 @@
 
     GpxFileModel        *m_fileModel;
     PositionTracking*   getPositionTracking();
+public slots:
+    virtual void clearModel();
  private:
     Waypoint            *m_currentPosition;
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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