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!

Qt Code:
  1. // Generated by CoffeeScript 1.7.1
  2. (function() {
  3. var param1, recursive;
  4.  
  5. param1 = 0;
  6.  
  7. recursive = function() {
  8. param1 = param1 + 1;
  9. if (param1 < 1000) {
  10. return recursive();
  11. }
  12. };
  13.  
  14. recursive();
  15.  
  16. }).call(this);
To copy to clipboard, switch view to plain text mode 

My cpp code is very simple:

Qt Code:
  1. QScriptEngine engine;
  2. QScriptContext* newContext = engine.pushContext();
  3. engine.evaluate(jscode);
  4. engine.popContext(); // after this point it crashes!
To copy to clipboard, switch view to plain text mode 

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:
Qt Code:
  1. [CODE]// Generated by CoffeeScript 1.7.1
  2. (function() {
  3. var param1, recursive;
  4.  
  5. param1 = 0;
  6.  
  7. recursive = function() {
  8. param1 = param1 + 1;
  9. if (param1 < 10) {
  10. return recursive();
  11. }
  12. };
  13.  
  14. recursive();
  15.  
  16. }).call(this);
To copy to clipboard, switch view to plain text mode 
[/CODE]

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