[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Aug 11 22:40:42 CEST 2004


CVS commit by staikos: 

add locking and fix my math


  M +8 -2      datawizard.ui.h   1.74
  M +8 -11     kstdoc.cpp   1.111


--- kdeextragear-2/kst/kst/datawizard.ui.h  #1.73:1.74
@@ -98,5 +98,7 @@ void DataWizard::sourceChanged( const QS
             ds = KstDataSource::loadSource(file);
             if (ds) {
+                KST::dataSourceList.lock().writeLock();
                 KST::dataSourceList.append(ds);
+                KST::dataSourceList.lock().writeUnlock();
             }
         }
@@ -350,5 +352,5 @@ void DataWizard::finished()
     memoryAvailable = S(kb_main_free + kb_main_buffers + kb_main_cached);
 #endif
-    memoryRequested += _ds->frameCount(_xVector->currentText())*_ds->samplesPerFrame(_xVector->currentText());
+    memoryRequested += _ds->frameCount(_xVector->currentText())*_ds->samplesPerFrame(_xVector->currentText())*sizeof(double);
     {
         QListViewItemIterator it(_vectors);
@@ -357,5 +359,5 @@ void DataWizard::finished()
             if (i->isOn()) {
                 QString field = it.current()->text(0);
-                memoryRequested += _ds->frameCount(field)*_ds->samplesPerFrame(field);
+                memoryRequested += _ds->frameCount(field)*_ds->samplesPerFrame(field)*sizeof(double);
             n_steps++;
             }
@@ -510,5 +512,7 @@ void DataWizard::finished()
                 c->setHasLines(false);
             }
+            KST::dataObjectList.lock().writeLock();
             KST::dataObjectList.append(KstDataObjectPtr(c));
+            KST::dataObjectList.lock().writeUnlock();
             static_cast<Kst2DPlot*>((*pit).data())->addCurve(c);
             if (!_onePlot->isChecked()) { // change plots if we are not onePlot...
@@ -562,5 +566,7 @@ void DataWizard::finished()
                     c->setHasLines(false);
                 }
+                KST::dataObjectList.lock().writeLock();
                 KST::dataObjectList.append(KstDataObjectPtr(c));
+                KST::dataObjectList.lock().writeUnlock();
                 static_cast<Kst2DPlot*>((*pit).data())->addCurve(c);
                 if (!_onePlot->isChecked()) { // change plots if we are not onePlot...

--- kdeextragear-2/kst/kst/kstdoc.cpp  #1.110:1.111
@@ -706,7 +706,4 @@ void KstDoc::forceUpdate() {
 
 bool KstDoc::event(QEvent *e) {
-  KMdiIterator<KMdiChildView*>* pIterator;
-  KstViewWindow* pView;
-
   if (e->type() == KstEventTypeThread) {
     _updating = true; // block update thread from sending events 'till we're done
@@ -721,14 +718,14 @@ bool KstDoc::event(QEvent *e) {
 
       if (KstApp::inst()) {
-        pIterator = KstApp::inst()->createIterator();
-        if (pIterator) {
-          while (pIterator->currentItem()) {
-            pView = dynamic_cast<KstViewWindow*>(pIterator->currentItem());
-            if (pView) {
-              pView->view()->update();
+        KMdiIterator<KMdiChildView*>* it = KstApp::inst()->createIterator();
+        if (it) {
+          while (it->currentItem()) {
+            KstViewWindow *view = dynamic_cast<KstViewWindow*>(it->currentItem());
+            if (view) {
+              view->view()->update();
             }
-            pIterator->next();
+            it->next();
           }
-          KstApp::inst()->deleteIterator(pIterator);
+          KstApp::inst()->deleteIterator(it);
         }
       }





More information about the Kst mailing list