Results 1 to 5 of 5

Thread: Crash on deletion of QScriptEngine object

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jun 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Crash on deletion of QScriptEngine object

    Qt Code:
    1. bool MYScriptEng::InitEngine()
    2. {
    3. if (m_pEngine==NULL) {
    4. m_pEngine = new QScriptEngine();
    5. }
    6. if (m_bDebugger && m_pDebugger==NULL) {
    7. m_pDebugger = new QScriptEngineDebugger();
    8. m_pDebugger->setAutoShowStandardWindow(true);
    9. m_debugWindow = m_pDebugger->standardWindow();
    10. m_debugWindow->setWindowModality(Qt::ApplicationModal);
    11. m_pDebugger->attachTo(m_pEngine);
    12. }
    13. if (m_pEngine) {
    14. // init the generic functions
    15. m_pEngine->globalObject().setProperty("print", m_pEngine->newFunction(myprint, 1));
    16. m_pEngine->globalObject().setProperty("alert", m_pEngine->newFunction(myalert, 1));
    17.  
    18. if (m_pMyWgt != NULL) {
    19. QScriptValue MyObj = m_pEngine->newQObject((QObject*)m_pMyWgt );
    20. m_pEngine->globalObject().setProperty("page", MyObj );
    21. }
    22.  
    23. m_pEngine->setProcessEventsInterval(100);
    24. }
    25. return true;
    26. }
    27.  
    28. void MyScriptEng::Init(MyWidget* pWgt)
    29. {
    30. if (m_bDebugger)//If debugger is available
    31. {
    32. m_pDebugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
    33. m_pExitAction= m_pDebugger->action(QScriptEngineDebugger::ContinueAction);
    34. }
    35. if(m_pEngine){
    36. QScriptValue ret = m_pEngine->evaluate(m_strContents);
    37. if (ret.isError()) {
    38. // reportScriptError(ret);
    39. // todo: display error
    40. }
    41. }
    42. }
    43.  
    44. void MyScriptEng::Deinit()
    45. {
    46. if(m_pEngine){
    47. if(m_pDebugger && m_pDebugger->state()==QScriptEngineDebugger::RunningState)
    48. {
    49.  
    50. m_pExitAction->trigger();//IS this enough to continue the debugger
    51. m_debugWindow->close();
    52. qApp->processEvents();
    53. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 11th August 2011 at 08:15. Reason: missing [code] tags

Similar Threads

  1. QString deletion
    By mukunda in forum Qt Programming
    Replies: 1
    Last Post: 14th March 2011, 07:34
  2. Crash on deletion of QScriptEngine object
    By The_Fallen in forum Qt Programming
    Replies: 4
    Last Post: 11th March 2010, 09:27
  3. Replies: 3
    Last Post: 14th October 2008, 21:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.