Hello,

I have an application, in which a thread is executing a qscript function

Qt Code:
  1. ExecuteThread::ExecuteThread(QString code, QObject *parent) :
  2. QThread(parent)
  3. {
  4. this->code = code;
  5. this->result = 0;
  6. ExecuteEngine = new QScriptEngine();
  7. }
  8.  
  9. void ExecuteThread::run(){
  10. ExecuteEngine = new QScriptEngine();
  11. QScriptValue fun = ExecuteEngine->evaluate("(" + code + ")");
  12. QScriptValue val = fun.call();
  13. result = val.toInteger();
  14. delete ExecuteEngine;
  15. }
  16.  
  17. int ExecuteThread::getResult(){
  18. return result;
  19. }
  20.  
  21. void ExecuteThread::stop(){
  22. ExecuteEngine->abortEvaluation(QScriptValue(-100));
  23. exit(0);
  24. }
To copy to clipboard, switch view to plain text mode 

Everything works fine, until there is an infinte loop in the QScript-function, then the thread stops at fun.call() and I can't delete the thread any more neither after calling stop() nor calling terminate(). Could you please tell me what I have to do in this case?