[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Wed Oct 5 20:22:32 CEST 2005


SVN commit 467607 by staikos:

purge datasources too


 M  +23 -7     kstdoc.cpp  


--- trunk/extragear/graphics/kst/kst/kstdoc.cpp #467606:467607
@@ -860,10 +860,10 @@
 
   while (again) {
     KST::vectorList.lock().readLock();
-    KstVectorList vectorList = KST::vectorList;
+    KstVectorList vectorList = QDeepCopy<KstVectorList>(KST::vectorList);
     KST::vectorList.lock().readUnlock();
     KST::matrixList.lock().readLock();
-    KstMatrixList matrixList = KST::matrixList;
+    KstMatrixList matrixList = QDeepCopy<KstMatrixList>(KST::matrixList);
     KST::matrixList.lock().readUnlock();
     
     KST::dataObjectList.lock().writeLock();
@@ -892,12 +892,12 @@
     KST::dataObjectList.lock().writeUnlock();
   
     // clear unused vectors that are editable 
-    for (KstVectorList::Iterator it = vectorList.begin(); it != vectorList.end(); ++it) {
+    for (KstVectorList::ConstIterator it = vectorList.begin(); it != vectorList.end(); ++it) {
       //kdDebug() << "VECTOR: " << (*it)->tagName() << " USAGE: " << (*it)->getUsage() << endl;
       if ((*it)->getUsage() == 1) {
         //kdDebug() << "    -> REMOVED" << endl;
         KST::vectorList.lock().writeLock();
-        KST::vectorList.remove((*it).data());
+        KST::vectorList.remove(const_cast<KstVector*>((*it).data()));
         KST::vectorList.lock().writeUnlock();
         again = true;
         modified = true;
@@ -907,11 +907,11 @@
     }
     
     // clear unused matrices that are editable
-    for (KstMatrixList::Iterator it = matrixList.begin(); it != matrixList.end(); ++it) {
+    for (KstMatrixList::ConstIterator it = matrixList.begin(); it != matrixList.end(); ++it) {
       if ((*it)->getUsage() == 1) {
         //kdDebug() << "    -> REMOVED" << endl;
         KST::matrixList.lock().writeLock();
-        KST::matrixList.remove((*it).data());
+        KST::matrixList.remove(const_cast<KstMatrix*>((*it).data()));
         KST::matrixList.lock().writeUnlock();
         again = true;
         modified = true;
@@ -920,7 +920,23 @@
       app->slotUpdateProgress(cnt, prg, purging);
     }
   }
-  
+
+  KstDataSourceList dataList;
+  KST::dataSourceList.lock().readLock();
+  for (KstDataSourceList::ConstIterator it = KST::dataSourceList.begin(); it != KST::dataSourceList.end(); ++it) {
+      if ((*it)->getUsage() == 1) {
+        //kdDebug() << "    -> REMOVED" << endl;
+        dataList.append(const_cast<KstDataSource*>((*it).data()));
+        modified = true;
+      }
+  }
+  KST::dataSourceList.lock().readUnlock();
+  KST::dataSourceList.lock().writeLock();
+  for (KstDataSourceList::ConstIterator it = dataList.begin(); it != dataList.end(); ++it) {
+    KST::dataSourceList.remove(const_cast<KstDataSource*>((*it).data()));
+  }
+  KST::dataSourceList.lock().writeUnlock();
+ 
   setModified(modified);
   emit updateDialogs();
   


More information about the Kst mailing list