[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed May 7 22:08:13 CEST 2003


CVS commit by staikos: 

memleak fix


  M +15 -1     kstvector.cpp   1.7
  M +4 -0      kstvector.h   1.5


--- kdeextragear-2/kst/kst/kstvector.cpp  #1.6:1.7
@@ -32,4 +32,11 @@ KstVector::KstVector() {
   NumShifted = 0;
   NumNew = 0;
+  SMax = 0L;
+  SMin = 0L;
+  SMean = 0L;
+  SSigma = 0L;
+  SRms = 0L;
+  SNS = 0L;
+  SSum = 0L;
 }
 
@@ -43,4 +50,11 @@ KstVector::~KstVector() {
     ScalarList->remove(SNS);
     ScalarList->remove(SSum);
+  }
+
+  deleteVectors();
+}
+
+
+void KstVector::deleteVectors() {
     delete SMax;
     SMax = 0L;
@@ -57,5 +71,4 @@ KstVector::~KstVector() {
     delete SSum;
     SSum = 0L;
-  }
 }
 
@@ -92,4 +105,5 @@ double KstVector::v(const int &in_i, con
 
 void KstVector::CreateScalars() {
+  deleteVectors();
   SMax = new KstScalar(Tag + "-Max");
   SMin = new KstScalar(Tag + "-Min");

--- kdeextragear-2/kst/kst/kstvector.h  #1.4:1.5
@@ -155,4 +155,8 @@ protected: // Protected attributes
   /** keep track of the slist for the destructor */
   KstScalarList *ScalarList;
+
+private:
+  void deleteVectors();
+
 };
 




More information about the Kst mailing list