[Kst] [Bug 135176] deadlock on exit with specific file

George Staikos staikos at kde.org
Fri Oct 6 06:34:30 CEST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=135176         
staikos kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From staikos kde org  2006-10-06 06:34 -------
SVN commit 592888 by staikos:

Remove some deadlock cases
BUG: 135171
BUG: 135176


 M  +15 -12    kstdoc.cpp  
 M  +5 -3      updatethread.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstdoc.cpp #592887:592888
 @ -792,14 +792,25  @
     }
   }
 
+  KST::dataObjectList.lock().writeLock();
+  // Avoid deadlock in DataObject destructor
+  KstDataObjectList tmpDol = QDeepCopy<KstDataObjectList>(KST::dataObjectList);
+  KST::dataObjectList.clear();
+  KST::dataObjectList.lock().unlock();
+  tmpDol.clear();
+
+  KST::dataSourceList.lock().writeLock();
+  KST::dataSourceList.clear();
+  KST::dataSourceList.lock().unlock();
+
+  KST::matrixList.lock().writeLock();
+  KST::matrixList.clear();
+  KST::matrixList.lock().unlock();
+
   KST::vectorList.lock().writeLock();
   KST::vectorList.clear();
   KST::vectorList.lock().unlock();
   
-  KST::matrixList.lock().writeLock();
-  KST::matrixList.clear();
-  KST::matrixList.lock().unlock();
-
   KST::scalarList.lock().writeLock();
   KST::scalarList.clear();
   KST::scalarList.lock().unlock();
 @ -808,14 +819,6  @
   KST::stringList.clear();
   KST::stringList.lock().unlock();
 
-  KST::dataSourceList.lock().writeLock();
-  KST::dataSourceList.clear();
-  KST::dataSourceList.lock().unlock();
-
-  KST::dataObjectList.lock().writeLock();
-  KST::dataObjectList.clear();
-  KST::dataObjectList.lock().unlock();
-
   emit updateDialogs();
 }
 
--- trunk/extragear/graphics/kst/src/libkstapp/updatethread.cpp #592887:592888
 @ -19,6 +19,8  @
 
 #include <assert.h>
 
+#include <qdeepcopy.h>
+
 #include "ksdebug.h"
 
 #include "kstdatacollection.h"
 @ -234,7 +236,9  @
     KstScalar::clearScalarsDirty(); // Must do this first and take a risk of
                                     // falling slightly behind
     KST::scalarList.lock().readLock();
-    for (KstScalarList::ConstIterator i = KST::scalarList.begin(); i != KST::scalarList.end(); ++i) {
+    KstScalarList sl = QDeepCopy<KstScalarList>(KST::scalarList); // avoid deadlock on exit
+    KST::scalarList.lock().unlock();
+    for (KstScalarList::ConstIterator i = sl.begin(); i != sl.end(); ++i) {
       KstScalarPtr sp = *i;
 
       sp->writeLock();
 @ -246,11 +250,9  @
       }
 
       if (_done) {
-        KST::scalarList.lock().unlock();
         return false;
       }
     }
-    KST::scalarList.lock().unlock();
   }
 
   if (U == KstObject::UPDATE) {


More information about the Kst mailing list