[Kst] kdeextragear-2/kst/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Sat Jul 17 00:48:18 CEST 2004
CVS commit by netterfield:
Some race removal in curve and vector dialogs.
Should be reviewed.
M +18 -1 kstcurvedialog_i.cpp 1.56
M +8 -2 kstvectordialog_i.cpp 1.39
--- kdeextragear-2/kst/kst/kstcurvedialog_i.cpp #1.55:1.56
@@ -153,5 +153,5 @@ void KstCurveDialogI::update() {
bool KstCurveDialogI::new_I() {
- KstWriteLocker ml(&KST::vectorList.lock());
+ //KstWriteLocker ml(&KST::vectorList.lock());
KstVectorList::Iterator VX, VY;
KstVectorList::Iterator EX, EY;
@@ -165,4 +165,5 @@ bool KstCurveDialogI::new_I() {
/* find VX and VY */
+ KST::vectorList.lock().readLock();
VX = KST::vectorList.findTag(_xVector->selectedVector());
VY = KST::vectorList.findTag(_yVector->selectedVector());
@@ -174,5 +175,12 @@ bool KstCurveDialogI::new_I() {
}
+ // readlock the vectors, bexause when we update the curve, they get read
KstReadLocker rl1(*VX), rl2(*VY);
+ if (EX != KST::vectorList.end()) {
+ KstReadLocker rl3(*EX);
+ }
+ if (EY != KST::vectorList.end()) {
+ KstReadLocker rl4(*EY);
+ }
QString tag_name = _tagName->text();
@@ -182,4 +190,5 @@ bool KstCurveDialogI::new_I() {
if (KST::dataTagNameNotUnique(tag_name)) {
_tagName->setFocus();
+ KST::vectorList.lock().readUnlock();
return false;
}
@@ -190,4 +199,6 @@ bool KstCurveDialogI::new_I() {
EY != KST::vectorList.end() ? *EY : KstVectorPtr(0L),
_curveAppearance->color());
+ KST::vectorList.lock().readUnlock();
+
curve->setHasPoints(_curveAppearance->showPoints());
curve->setHasLines(_curveAppearance->showLines());
@@ -241,8 +252,11 @@ bool KstCurveDialogI::new_I() {
bool KstCurveDialogI::edit_I() {
+ DP->writeLock();
+
/* verify that the curve name is unique */
if (_tagName->text() != DP->tagName()) {
if (KST::dataTagNameNotUnique(_tagName->text())) {
_tagName->setFocus();
+ DP->writeUnlock();
return false;
}
@@ -276,4 +290,7 @@ bool KstCurveDialogI::edit_I() {
DP->update(-1);
+
+ DP->writeUnlock();
+
emit modified();
--- kdeextragear-2/kst/kst/kstvectordialog_i.cpp #1.38:1.39
@@ -88,10 +88,16 @@ void KstVectorDialogI::updateCompletion(
Field->clear();
- /* update filename list and fill axes combo boxes */
+ /* update filename list and ll axes combo boxes */
+ KST::dataSourceList.lock().readLock();
KstDataSourcePtr ds = *KST::dataSourceList.findFileName(FileName->url());
+ KST::dataSourceList.lock().readUnlock();
+
if (!ds && FileName->url() != "stdin") {
ds = KstDataSource::loadSource(FileName->url());
if (ds) { // FIXME we should eventually make KstDataSource::loadFieldList()
+ // FIXME: currently, putting a datasource in the list keeps it there forever
+ KST::dataSourceList.lock().writeLock();
KST::dataSourceList.append(ds);
+ KST::dataSourceList.lock().writeUnlock();
}
}
@@ -199,5 +205,5 @@ bool KstVectorDialogI::new_I() {
vectorList.clear();
- /* if there is not an active KstFile, create one */
+ /* if there is not an active DataSource, create one */
{
KST::dataSourceList.lock().writeLock();
More information about the Kst
mailing list