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

Eli Fidler eli at staikos.net
Mon Nov 5 21:42:14 CET 2007


SVN commit 733198 by fidler:

oops.. fix locking


 M  +4 -4      objectstore.cpp  
 M  +5 -4      objectstore.h  


--- branches/work/kst/portto4/kst/src/libkst/objectstore.cpp #733197:733198
@@ -226,7 +226,7 @@
     return false;
   }
 
-  KstWriteLocker(&this->_lock);
+  KstWriteLocker l(&this->_lock);
 
   if (!_list.contains(o)) {
 #if NAMEDEBUG > 1
@@ -281,7 +281,7 @@
     return false;
   }
 
-  KstWriteLocker(&this->_lock);
+  KstWriteLocker l(&this->_lock);
 
   if (objectExists(newTag)) {
     // TODO: what to do if tag exists?
@@ -319,7 +319,7 @@
     return NULL;
   }
 
-  KstReadLocker(&this->_lock);
+  KstReadLocker l(&this->_lock);
 
   QStringList fullTag = tag.fullTag();
 
@@ -368,7 +368,7 @@
 
 
 bool ObjectStore::objectExists(const ObjectTag& tag) const {
-  KstReadLocker(&this->_lock);
+  KstReadLocker l(&this->_lock);
   ObjectTreeNode *n = _root->descendant(tag.fullTag());
   return n && n->object();
 }
--- branches/work/kst/portto4/kst/src/libkst/objectstore.h #733197:733198
@@ -145,7 +145,7 @@
 // this is an inefficient implementation for now
 template<class T>
 const ObjectList<T> ObjectStore::getObjects() const {
-  KstReadLocker(&(this->_lock));
+  KstReadLocker l(&(this->_lock));
   ObjectList<T> rc;
 
   for (QList<ObjectPtr>::ConstIterator it = _list.begin(); it != _list.end(); ++it) {
@@ -161,7 +161,7 @@
 
 template<class T>
 SharedPtr<T> ObjectStore::createObject(const ObjectTag& tag) {
-  KstWriteLocker(&(this->_lock));
+  KstWriteLocker l(&(this->_lock));
   T *object = new T(this, tag);
   addObject(object);
 
@@ -171,7 +171,7 @@
 
 template<class T>
 SharedPtr<T> ObjectStore::createObject(const QDomElement& e) {
-  KstWriteLocker(&(this->_lock));
+  KstWriteLocker l(&(this->_lock));
   T *object = new T(this, e);
   addObject(object);
 
@@ -181,6 +181,7 @@
 
 template<class T>
 ObjectTag ObjectStore::suggestObjectTag(const QString& basedOn, const ObjectTag& contextTag) const {
+  KstReadLocker l(&(this->_lock));
   ObjectTag tag(QString::null, contextTag, false);
   if (basedOn.isEmpty()) {
     // anonymous object
@@ -204,7 +205,7 @@
     return false;
   }
 
-  KstWriteLocker(&this->_lock);
+  KstWriteLocker l(&this->_lock);
 
   o->_store = 0L;
 


More information about the Kst mailing list