[Kst] [Bug 129068] Can select slave vector of object for object's input
Andrew Walker
arwalker at sumusltd.com
Wed May 16 20:45:47 CEST 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=129068
------- Additional Comments From arwalker sumusltd com 2007-05-16 20:45 -------
SVN commit 665376 by arwalker:
CCBUG:129068 Warn user if event monitor entry has a recursion. Also prevent crash from using an invalid expression when the event slave vector is used as input to the expression.
M +50 -44 ksteventmonitorentry.cpp
--- branches/work/kst/1.5/kst/src/libkstapp/ksteventmonitorentry.cpp #665375:665376
@ -130,7 +130,11 @
Equation::FoldVisitor vis(&ctx, &_pExpression);
KstStringMap stm;
if (_pExpression->collectObjects(_vectorsUsed, _inputScalars, stm)) {
- _isValid = true;
+ if (recursion()) {
+ KstDebug::self()->log( i18n("There is a recursion resulting from the event monitor entry you entered, '%s'").arg(_event), KstDebug::Warning);
+ } else {
+ _isValid = true;
+ }
} else {
//we have bad objects...
delete (Equation::Node*)ParsedEquation;
@ -190,63 +194,65 @
if (!_pExpression) {
reparse();
}
+ if (_isValid) {
+ KstVectorPtr xv = *_xVector;
+ KstVectorPtr yv = *_yVector;
+ int ns = 1;
- KstVectorPtr xv = *_xVector;
- KstVectorPtr yv = *_yVector;
- int ns = 1;
+ for (KstVectorMap::ConstIterator i = _vectorsUsed.begin(); i != _vectorsUsed.end(); ++i) {
+ ns = kMax(ns, i.data()->length());
+ }
- for (KstVectorMap::ConstIterator i = _vectorsUsed.begin(); i != _vectorsUsed.end(); ++i) {
- ns = kMax(ns, i.data()->length());
- }
+ double *rawValuesX = 0L;
+ double *rawValuesY = 0L;
+ if (xv && yv) {
+ if (xv->resize(ns)) {
+ rawValuesX = xv->value();
+ }
- double *rawValuesX = 0L;
- double *rawValuesY = 0L;
- if (xv && yv) {
- if (xv->resize(ns)) {
- rawValuesX = xv->value();
+ if (yv->resize(ns)) {
+ rawValuesY = yv->value();
+ }
}
- if (yv->resize(ns)) {
- rawValuesY = yv->value();
- }
- }
+ Equation::Context ctx;
+ ctx.sampleCount = ns;
+ ctx.x = 0.0;
- Equation::Context ctx;
- ctx.sampleCount = ns;
- ctx.x = 0.0;
+ if (needToEvaluate()) {
+ if (_pExpression) {
+ for (ctx.i = _numDone; ctx.i < ns; ++ctx.i) {
+ const double value = _pExpression->value(&ctx);
- if (needToEvaluate()) {
- if (_pExpression) {
- for (ctx.i = _numDone; ctx.i < ns; ++ctx.i) {
- const double value = _pExpression->value(&ctx);
- if (value != 0.0) { // The expression evaluates to true
- log(ctx.i);
- if (rawValuesX && rawValuesY) {
- rawValuesX[ctx.i] = ctx.i;
- rawValuesY[ctx.i] = 1.0;
+ if (value != 0.0) { // The expression evaluates to true
+ log(ctx.i);
+ if (rawValuesX && rawValuesY) {
+ rawValuesX[ctx.i] = ctx.i;
+ rawValuesY[ctx.i] = 1.0;
+ }
+ } else {
+ if (rawValuesX && rawValuesY) {
+ rawValuesX[ctx.i] = ctx.i;
+ rawValuesY[ctx.i] = 0.0;
+ }
}
- } else {
- if (rawValuesX && rawValuesY) {
- rawValuesX[ctx.i] = ctx.i;
- rawValuesY[ctx.i] = 0.0;
- }
}
+ _numDone = ns;
+ logImmediately();
}
+ } else {
_numDone = ns;
- logImmediately();
}
- } else {
- _numDone = ns;
- }
- if (xv) {
- xv->setDirty();
- xv->update(updateCounter);
- }
+ if (xv) {
+ xv->setDirty();
+ xv->update(updateCounter);
+ }
- if (yv) {
- yv->setDirty();
- yv->update(updateCounter);
+ if (yv) {
+ yv->setDirty();
+ yv->update(updateCounter);
+ }
}
unlockInputsAndOutputs();
More information about the Kst
mailing list