Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QtScript problem: corrupted Javascirpt variables
lbalogh last edited by
The device is continuously sending measurement data to the program which updates the corresponding variables of the script engine.
Moreover, in the engine via some custom functions the device is controller.
Unfortunately, it seems that sometimes (not always) the variables defined in the engine become corrupted.
QScriptValue own_function(QScriptContext *context, QScriptEngine *engine)
Text = context->argument(0).toString(); const QString ret = do_some_processing( Text); return QScriptValue( ret );
x = x+5;
own_function("value = " + x);
And sometimes, the variable Text contains invalid string, for example "value = 12[o".
Some additional info: script engine runs concurently:
connect(&watcher, SIGNAL(finished()), this, SLOT(onEvalFinished()));
future = QtConcurrent::run(scriptEngine, &QScriptEngine::evaluate, script_code);
In this project Qt 4.8 is used.
Do you have any idea how it can go wrong?