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

Peter Kümmel syntheticpp at gmx.net
Wed Feb 2 12:36:01 CET 2011


SVN commit 1218460 by kuemmel:

fix possible crash

 M  +1 -1      libkst/objectstore.cpp  
 M  +1 -1      libkst/objectstore.h  
 M  +3 -7      libkst/sharedptr.h  
 M  +5 -0      libkstapp/datawizard.cpp  


--- branches/work/kst/portto4/kst/src/libkst/objectstore.cpp #1218459:1218460
@@ -80,7 +80,7 @@
   return true;
 }
 
-ObjectPtr ObjectStore::retrieveObject(const QString name) const {
+ObjectPtr ObjectStore::retrieveObject(const QString& name) const {
 
   int match = -1;
 
--- branches/work/kst/portto4/kst/src/libkst/objectstore.h #1218459:1218460
@@ -46,7 +46,7 @@
     template<class T> bool addObject(T *o);
     bool removeObject(Object *o);
 
-    ObjectPtr retrieveObject(const QString name) const;
+    ObjectPtr retrieveObject(const QString& name) const;
 
     bool isEmpty() const;
     void clear();
--- branches/work/kst/portto4/kst/src/libkst/sharedptr.h #1218459:1218460
@@ -180,15 +180,11 @@
    */
   int count() const { Q_ASSERT(isPtrValid()); return ptr->_KShared_count(); } // for debugging purposes
 
+
+  bool isPtrValid() const { return ptr != 0; }
+
 private:
   T* ptr;
-  bool isPtrValid() const { 
-    /*
-    if (ptr == (T*)1)
-      return false;
-    */
-    return ptr != 0; 
-  } 
 };
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #1218459:1218460
@@ -714,6 +714,11 @@
 
   DataSourcePtr ds = _pageDataSource->dataSource();
 
+  if (!ds.isPtrValid()) {
+    return;
+  }
+
+
   // check for sufficient memory
   unsigned long memoryRequested = 0, memoryAvailable = 1024*1024*1024; // 1GB
   double frames;


More information about the Kst mailing list