[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Thu Nov 17 04:18:10 CET 2005


SVN commit 480927 by staikos:

no need to hold both locks 


 M  +8 -7      kstdatacollection.cpp  


--- trunk/extragear/graphics/kst/kst/kstdatacollection.cpp #480926:480927
@@ -96,14 +96,15 @@
   }
 
   /* verify that the tag name is not used by a data object */
-  KstReadLocker ml(&KST::vectorList.lock());
-  KstReadLocker ml2(&KST::scalarList.lock());
-  if (KST::vectorList.findTag(tag) != KST::vectorList.end() ||
-      KST::scalarList.findTag(tag) != KST::scalarList.end()) {
-      return true;
+  KST::vectorList.lock().readLock();
+  bool vc = KST::vectorList.findTag(tag) != KST::vectorList.end();
+  KST::vectorList.lock().readUnlock();
+  if (!vc) {
+    KST::scalarList.lock().readLock();
+    vc = KST::scalarList.findTag(tag) != KST::scalarList.end();
+    KST::scalarList.lock().readUnlock();
   }
-
-  return false;
+  return vc;
 }
 
 


More information about the Kst mailing list