[Kst] kdeextragear-2/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Wed Jul 21 23:41:37 CEST 2004


CVS commit by netterfield: 

some more locking.  Couple questionable points...


  M +28 -5     ksteqdialog_i.cpp   1.56


--- kdeextragear-2/kst/kst/ksteqdialog_i.cpp  #1.55:1.56
@@ -95,4 +95,6 @@ void KstEqDialogI::updateWindow() {
 void KstEqDialogI::_fillFieldsForEdit() {
   if ( DP == 0L ) return; // shouldn't be needed
+
+  //DP->writeLock();
   _tagName->setText( DP->tagName() );
 
@@ -122,4 +124,6 @@ void KstEqDialogI::_fillFieldsForEdit() 
     DP->Point.getType(), DP->lineWidth(), DP->lineStyle());
 
+  //DP->writeUnlock();
+
   _curvePlacement->hide();
 
@@ -166,4 +170,7 @@ bool KstEqDialogI::new_I() {
   bool ok;
 
+  // FIXME?  eq can implicitly refer to exisiting vectors.
+  // We are not read-locking them here.  As long as we don't update,
+  // we could be OK... but it makes me nervous.
   QString tag_name = _tagName->text();
   tag_name.replace(i18n("<New_Equation>"), Equation->text());
@@ -304,5 +310,5 @@ bool KstEqDialogI::edit_I() {
     }
   }
-
+  DP->writeLock();
   DP->setTagName(_tagName->text());
 
@@ -313,6 +319,8 @@ bool KstEqDialogI::edit_I() {
   DP->setLineStyle(_curveAppearance->lineStyle());
   DP->Point.setType(_curveAppearance->pointType());
-
-  if ( !_checkEntries() ) return false;
+  if ( !_checkEntries() ) {
+    DP->writeUnlock();
+    return false;
+  }
 
   if (UseExistingVector->isChecked()) {
@@ -327,6 +337,12 @@ bool KstEqDialogI::edit_I() {
     KST::vectorList.lock().readUnlock();
 
+    // FIXME: for reasons I don't understand, I had to writeunlock DP
+    // before setting the static vector.  If you know why, and all is well,
+    // remove this fixme.  But this seems very wrong.
+    DP->writeUnlock();
     DP->setExistingXVector(*i, DoInterpolation->isChecked());
+    DP->writeLock();
   } else {
+
     bool ok;
     int n = N->value();
@@ -333,5 +349,11 @@ bool KstEqDialogI::edit_I() {
     double x0 = XMin->text().toDouble(&ok);
     double x1 = XMax->text().toDouble(&ok);
+
+    // FIXME: for reasons I don't understand, I had to writeunlock DP
+    // before setting the static vector.  If you know why, and all is well,
+    // remove this fixme.  But this seems very wrong.
+    DP->writeUnlock();
     DP->setStaticXVector(x0, x1, n);
+    DP->writeLock();
   }
 
@@ -340,4 +362,5 @@ bool KstEqDialogI::edit_I() {
     KMessageBox::sorry(0L, i18n("There is a syntax error in the equation "
                                 "you entered.  Please fix it."));
+    DP->writeUnlock();
     return false;
   }
@@ -342,6 +365,6 @@ bool KstEqDialogI::edit_I() {
     return false;
   }
-
   DP->update();
+  DP->writeUnlock();
 
   emit modified();





More information about the Kst mailing list