tonka3000
19th September 2014, 15:57
Hy@everybody,
i have some troubles with the QScriptEngine and the context. I have a simple script (originally written in coffeescript). I call these script with the engine (with a new pushed context) and i get an crash after popContext().
The script is a simple recursive function which call itself 1000 times. I have created much more complex apps with QtScript and never had problems like these!
// Generated by CoffeeScript 1.7.1
(function() {
var param1, recursive;
param1 = 0;
recursive = function() {
param1 = param1 + 1;
if (param1 < 1000) {
return recursive();
}
};
recursive();
}).call(this);
My cpp code is very simple:
QScriptEngine engine;
QScriptContext* newContext = engine.pushContext();
engine.evaluate(jscode);
engine.popContext(); // after this point it crashes!
It crashes after engine.popContext(). I need the context to avoid variables in the global-object by default (and this snippet worked the last 2 months).
If i change the recursive counter in the script from 1000 to 10, it works well.
Working script:
// Generated by CoffeeScript 1.7.1
(function() {
var param1, recursive;
param1 = 0;
recursive = function() {
param1 = param1 + 1;
if (param1 < 10) {
return recursive();
}
};
recursive();
}).call(this);
I can reproduce this problems with 4.7.3 and 4.8.5 (i have not tested 5.x yet). I'm on a Windows 7 x64 SP1 machine with Visual Studio 2010 SP1 compiler.
Does anybody has this problem?
Can anybody reproduce this error on your windows/linux/mac machine?
BTW: This code works perfectly in node.js
Thanks in advance
Tonka
i have some troubles with the QScriptEngine and the context. I have a simple script (originally written in coffeescript). I call these script with the engine (with a new pushed context) and i get an crash after popContext().
The script is a simple recursive function which call itself 1000 times. I have created much more complex apps with QtScript and never had problems like these!
// Generated by CoffeeScript 1.7.1
(function() {
var param1, recursive;
param1 = 0;
recursive = function() {
param1 = param1 + 1;
if (param1 < 1000) {
return recursive();
}
};
recursive();
}).call(this);
My cpp code is very simple:
QScriptEngine engine;
QScriptContext* newContext = engine.pushContext();
engine.evaluate(jscode);
engine.popContext(); // after this point it crashes!
It crashes after engine.popContext(). I need the context to avoid variables in the global-object by default (and this snippet worked the last 2 months).
If i change the recursive counter in the script from 1000 to 10, it works well.
Working script:
// Generated by CoffeeScript 1.7.1
(function() {
var param1, recursive;
param1 = 0;
recursive = function() {
param1 = param1 + 1;
if (param1 < 10) {
return recursive();
}
};
recursive();
}).call(this);
I can reproduce this problems with 4.7.3 and 4.8.5 (i have not tested 5.x yet). I'm on a Windows 7 x64 SP1 machine with Visual Studio 2010 SP1 compiler.
Does anybody has this problem?
Can anybody reproduce this error on your windows/linux/mac machine?
BTW: This code works perfectly in node.js
Thanks in advance
Tonka