when I use the new QJSEngine (the v8 stuff), and when I try the following (by calling run()), the program crashes:
QJSEngine *script_engine; // global variable
QJSValue result = engine->evaluate("1+1");
script_engine = new QScriptEngine;
for (int i=0;i<100;++i) jobs.append(i);
qDebug() << "starting jobs...";
QtConcurrent::blockingMap (jobs, run_func );
qDebug() << "jobs finished";
it plots an message [after the "starting jobs..." line]:
Fatal error in q:\qt5_workdir\w\s\qtjsbackend\src\3rdparty\v8\src\isolate.h, line 446
CHECK(isolate != 0) failed
I use Qt 5.1.1, and MSVC2010 32bit.
For me it looks as if only one thread can use the JS-Engine (note: this is a console app, no GUI or QML around). However, https://bugreports.qt-project.org/browse/QTBUG-23099 hints otherwise (and is closed). I did not find much in the documentation about that...
I tried the same thing with the "old" QScriptEngine, and the result was similar, i.e. a crash but here without a nice warning.
So the questions are:
(3) are there differences between QJsEngine and QScriptEngine with regard to multithreaded script execution?
thanks a lot for your answers!
I encountered the same problem and filed a bugreport on it.
Please upvote it.