[Kst] branches/work/kst/1.5/kst/src
Andrew Walker
arwalker at sumusltd.com
Wed May 16 22:22:33 CEST 2007
SVN commit 665403 by arwalker:
CCBUG:129068 Prevent updates when an object is recursed
M +3 -0 libkstapp/kstbasicdialog_i.cpp
M +2 -0 libkstapp/kstcsddialog_i.cpp
M +4 -0 libkstapp/ksteqdialog_i.cpp
M +8 -6 libkstapp/ksthsdialog_i.cpp
M +3 -0 libkstapp/kstplugindialog_i.cpp
M +8 -6 libkstapp/kstpsddialog_i.cpp
M +4 -0 libkstmath/kstbasicplugin.cpp
M +4 -0 libkstmath/kstcplugin.cpp
M +7 -0 libkstmath/kstcsd.cpp
M +12 -0 libkstmath/kstdataobject.cpp
M +4 -0 libkstmath/kstdataobject.h
M +5 -0 libkstmath/kstequation.cpp
M +5 -0 libkstmath/ksthistogram.cpp
M +6 -0 libkstmath/kstpsd.cpp
--- branches/work/kst/1.5/kst/src/libkstapp/kstbasicdialog_i.cpp #665402:665403
@@ -311,7 +311,10 @@
KMessageBox::sorry(this, i18n("There is an error in the values you entered."));
return false;
}
+
+ ptr->setRecursed(false);
if (ptr->recursion()) {
+ ptr->setRecursed(true);
KMessageBox::sorry(this, i18n("There is a recursion resulting from the plugin you entered."));
return false;
}
--- branches/work/kst/1.5/kst/src/libkstapp/kstcsddialog_i.cpp #665402:665403
@@ -308,8 +308,10 @@
csPtr->setOutput(PSDType(_w->_kstFFTOptions->Output->currentItem()));
}
+ csPtr->setRecursed(false);
if (csPtr->recursion()) {
KMessageBox::error(this, i18n("There is a recursion resulting from the spectrogram you entered."));
+ csPtr->setRecursed(true);
csPtr->unlock();
return false;
}
--- branches/work/kst/1.5/kst/src/libkstapp/ksteqdialog_i.cpp #665402:665403
@@ -313,12 +313,16 @@
eqPtr->unlock();
return true;
}
+
+ eqPtr->setRecursed(false);
if (eqPtr->recursion()) {
KMessageBox::error(this, i18n("There is a recursion resulting from the equation you entered."));
+ eqPtr->setRecursed(true);
eqPtr->unlock();
return false;
}
}
+
eqPtr->unlock();
return true;
--- branches/work/kst/1.5/kst/src/libkstapp/ksthsdialog_i.cpp #665402:665403
@@ -331,12 +331,6 @@
hsPtr->writeLock();
- if (hsPtr->recursion()) {
- KMessageBox::error(this, i18n("There is a recursion resulting from the histogram you entered."));
- hsPtr->unlock();
- return false;
- }
-
if (_nDirty) {
hsPtr->setNBins(new_n_bins);
}
@@ -361,6 +355,14 @@
}
}
+ hsPtr->setRecursed(false);
+ if (hsPtr->recursion()) {
+ KMessageBox::error(this, i18n("There is a recursion resulting from the histogram you entered."));
+ hsPtr->setRecursed(true);
+ hsPtr->unlock();
+ return false;
+ }
+
hsPtr->setDirty();
hsPtr->unlock();
return true;
--- branches/work/kst/1.5/kst/src/libkstapp/kstplugindialog_i.cpp #665402:665403
@@ -616,6 +616,7 @@
int pitem = _w->PluginCombo->currentItem();
KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]);
+ pp->setRecursed(false);
pp->inputVectors().clear();
pp->inputScalars().clear();
pp->inputStrings().clear();
@@ -640,8 +641,10 @@
return false;
}
+ pp->setRecursed(false);
if (pp->recursion()) {
KMessageBox::sorry(this, i18n("There is a recursion resulting from the plugin you entered."));
+ pp->setRecursed(true);
return false;
}
--- branches/work/kst/1.5/kst/src/libkstapp/kstpsddialog_i.cpp #665402:665403
@@ -261,12 +261,6 @@
psPtr->setVector(v);
}
- if (psPtr->recursion()) {
- KMessageBox::error(this, i18n("There is a recursion resulting from the spectrum you entered."));
- psPtr->unlock();
- return false;
- }
-
// get the values that need to be checked for consistency
double pSampRate;
int pFFTLen;
@@ -333,6 +327,14 @@
psPtr->setInterpolateHoles(_w->_kstFFTOptions->InterpolateHoles->isChecked());
}
+ psPtr->setRecursed(false);
+ if (psPtr->recursion()) {
+ KMessageBox::error(this, i18n("There is a recursion resulting from the spectrum you entered."));
+ psPtr->setRecursed(true);
+ psPtr->unlock();
+ return false;
+ }
+
psPtr->unlock();
return true;
}
--- branches/work/kst/1.5/kst/src/libkstmath/kstbasicplugin.cpp #665402:665403
@@ -205,6 +205,10 @@
KstObject::UpdateType KstBasicPlugin::update(int updateCounter) {
Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);
+ if (recursed()) {
+ return setLastUpdateResult(NO_CHANGE);
+ }
+
bool force = dirty();
setDirty(false);
--- branches/work/kst/1.5/kst/src/libkstmath/kstcplugin.cpp #665402:665403
@@ -256,6 +256,10 @@
return setLastUpdateResult(NO_CHANGE);
}
+ if (recursed()) {
+ return setLastUpdateResult(NO_CHANGE);
+ }
+
bool force = dirty();
setDirty(false);
--- branches/work/kst/1.5/kst/src/libkstmath/kstcsd.cpp #665402:665403
@@ -171,6 +171,10 @@
return lastUpdateResult();
}
+ if (recursed()) {
+ return setLastUpdateResult(NO_CHANGE);
+ }
+
writeLockInputsAndOutputs();
if (update_counter <= 0) {
@@ -255,6 +259,9 @@
void KstCSD::setVector(KstVectorPtr new_v) {
KstVectorPtr v = _inputVectors[INVECTOR];
+
+ setRecursed(false);
+
if (v) {
if (v == new_v) {
return;
--- branches/work/kst/1.5/kst/src/libkstmath/kstdataobject.cpp #665402:665403
@@ -40,6 +40,7 @@
//kstdDebug() << "+++ CREATING DATA OBJECT: " << (void*)this << endl;
_curveHints = new KstCurveHintList;
_isInputLoaded = false;
+ _isRecursed = false;
}
KstDataObject::KstDataObject(const QDomElement& e) : KstObject() {
@@ -47,6 +48,7 @@
//kstdDebug() << "+++ CREATING DATA OBJECT: " << (void*)this << endl;
_curveHints = new KstCurveHintList;
_isInputLoaded = false;
+ _isRecursed = false;
}
@@ -796,5 +798,15 @@
}
+void KstDataObject::setRecursed( bool isRecursed ) {
+ _isRecursed = isRecursed;
+}
+
+
+bool KstDataObject::recursed() const {
+ return _isRecursed;
+}
+
+
#include "kstdataobject.moc"
// vim: ts=2 sw=2 et
--- branches/work/kst/1.5/kst/src/libkstmath/kstdataobject.h #665402:665403
@@ -57,6 +57,9 @@
virtual Kind kind() const { return Generic; }
virtual int sampleCount() const { return 0; }
+ virtual bool recursed() const;
+ virtual void setRecursed(bool recursed);
+
// If you use these, you must lock() and unlock() the object as long as you
// hold the reference
const KstVectorMap& inputVectors() const { return _inputVectors; }
@@ -148,6 +151,7 @@
QString _typeString, _type;
bool _isInputLoaded;
+ bool _isRecursed : 1;
QValueList<QPair<QString,QString> > _inputVectorLoadQueue;
QValueList<QPair<QString,QString> > _inputScalarLoadQueue;
QValueList<QPair<QString,QString> > _inputStringLoadQueue;
--- branches/work/kst/1.5/kst/src/libkstmath/kstequation.cpp #665402:665403
@@ -193,6 +193,10 @@
return setLastUpdateResult(NO_CHANGE);
}
+ if (recursed()) {
+ return setLastUpdateResult(NO_CHANGE);
+ }
+
assert(update_counter >= 0);
if (_xInVector == _inputVectors.end()) {
@@ -295,6 +299,7 @@
// document loading with vector lazy-loading
setDirty();
_equation = in_fn;
+ setRecursed(false);
VectorsUsed.clear();
ScalarsUsed.clear();
--- branches/work/kst/1.5/kst/src/libkstmath/ksthistogram.cpp #665402:665403
@@ -158,6 +158,10 @@
bool force = dirty();
setDirty(false);
+ if (recursed()) {
+ return setLastUpdateResult(KstObject::NO_CHANGE);
+ }
+
if (KstObject::checkUpdateCounter(update_counter) && !force) {
return lastUpdateResult();
}
@@ -320,6 +324,7 @@
void KstHistogram::setVector(KstVectorPtr new_v) {
_inputVectors[RAWVECTOR] = new_v;
+ setRecursed(false);
}
--- branches/work/kst/1.5/kst/src/libkstmath/kstpsd.cpp #665402:665403
@@ -194,6 +194,10 @@
return lastUpdateResult();
}
+ if (recursed()) {
+ return setLastUpdateResult(NO_CHANGE);
+ }
+
writeLockInputsAndOutputs();
KstVectorPtr iv = _inputVectors[INVECTOR];
@@ -370,6 +374,8 @@
void KstPSD::setVector(KstVectorPtr new_v) {
Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);
+ setRecursed(false);
+
KstVectorPtr v = _inputVectors[INVECTOR];
if (v) {
if (v == new_v) {
More information about the Kst
mailing list