[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Tue Apr 13 21:37:40 CEST 2004


CVS commit by arwalker: 

Perform some additional checks before using potentially invalid 
pointers. This prevents Kst from crashing when using plugins.


  M +29 -19    updatethread.cpp   1.9


--- kdeextragear-2/kst/kst/updatethread.cpp  #1.8:1.9
@@ -175,4 +175,5 @@ bool UpdateThread::doUpdates(bool force)
     for (i = 0; i < ncl.count(); ++i) {
       KstDataObjectPtr dop = ncl[i];
+      if( dop != NULL ) {
 #if UPDATEDEBUG > 0
       kdDebug() << "updating non-curve: " << (void*)dop << " - " << dop->tagName() << endl;
@@ -189,4 +189,9 @@ bool UpdateThread::doUpdates(bool force)
         return U == KstObject::UPDATE;
       }
+      } else {
+#if UPDATEDEBUG > 0
+        kdDebug() << "updating non-curve error: dop is NULL" << endl;
+#endif
+      }
     }
 
@@ -194,12 +199,12 @@ bool UpdateThread::doUpdates(bool force)
     if (U == KstObject::UPDATE || force) {
       for (i = 0; i < cl.count(); ++i) {
-        KstBaseCurvePtr dop = cl[i];
+        KstBaseCurvePtr bcp = cl[i];
+        if( bcp != NULL ) {
 #if UPDATEDEBUG > 0
-        kdDebug() << "updating curve: " << (void*)dop << " - " << dop->tagName() << endl;
+          kdDebug() << "updating curve: " << (void*)bcp << " - " << bcp->tagName() << endl;
 #endif
-
-        dop->writeLock();
-        dop->update(_updateCounter);
-        dop->writeUnlock();
+          bcp->writeLock();
+          bcp->update(_updateCounter);
+          bcp->writeUnlock();
 
         if (_done || _paused) {
@@ -209,4 +214,9 @@ bool UpdateThread::doUpdates(bool force)
           return U == KstObject::UPDATE;
         }
+        } else {
+#if UPDATEDEBUG > 0
+          kdDebug() << "updating curve error: bcp is NULL" << endl;
+#endif 
+        }
       }
     }





More information about the Kst mailing list