[Kst] branches/work/kst/portto4/kst/src/libkst

Mike Fenton mike at staikos.net
Fri Nov 30 15:29:28 CET 2007


SVN commit 743292 by fenton:

Add proper cleanup of DataSource dependents.


 M  +6 -16     datasource.cpp  
 M  +2 -0      datasource.h  
 M  +1 -0      objectstore.cpp  


--- branches/work/kst/portto4/kst/src/libkst/datasource.cpp #743291:743292
@@ -501,26 +501,16 @@
 
 DataSource::~DataSource() {
   //  qDebug() << "DataSource destructor: " << tag().tagString() << endl;
+}
 
-  // FIXME: remove _numFramesScalar and metadata
-#if 0
-  scalarList.lock().writeLock();
-//  qDebug() << "  removing numFrames scalar" << endl;
-  scalarList.removeObject(_numFramesScalar);
-  scalarList.lock().unlock();
 
-//  qDebug() << "  removing metadata strings" << endl;
-  stringList.lock().writeLock();
-  stringList.setUpdateDisplayTags(false);
+void DataSource::deleteDependents() {
+  _store->removeObject(_numFramesScalar);
+  _numFramesScalar = 0L;
+
   for (QHash<QString, String*>::Iterator it = _metaData.begin(); it != _metaData.end(); ++it) {
-//    qDebug() << "    removing " << it.current()->tag().tagString() << endl;
-    stringList.removeObject(it.value());
+    _store->removeObject(it.value());
   }
-  stringList.setUpdateDisplayTags(true);
-  stringList.lock().unlock();
-
-  _numFramesScalar = 0L;
-#endif
 }
 
 
--- branches/work/kst/portto4/kst/src/libkst/datasource.h #743291:743292
@@ -225,6 +225,8 @@
     // in (ms)
     virtual double relativeTimeForSample(int sample, bool *ok = 0L);
 
+    virtual void deleteDependents();
+
   protected:
     void updateNumFramesScalar();
 
--- branches/work/kst/portto4/kst/src/libkst/objectstore.cpp #743291:743292
@@ -272,6 +272,7 @@
     qDebug() << "  removing object from list";
 #endif
     if (ds) {
+      ds->deleteDependents();
       _dataSourceList.removeAll(ds);
     } else {
       o->deleteDependents();


More information about the Kst mailing list