Results 1 to 5 of 5

Thread: Crash on deletion of QScriptEngine object

  1. #1
    Join Date
    Jun 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Crash on deletion of QScriptEngine object

    Hi,

    In my app I create a new QScriptEngine object, and delete it before quitting the app. Unfortunately the app crashes when coming to the line with the delete.I am giving call stack here. what could be the reason for this??. Please give any suggestion.

    It crashes in ASSERT(!m_globalData->dynamicGlobalObject) in ..\JavaScriptCore\runtime\Collector.cpp

    Thanks


    QtScriptd4.dll!QTJSC::Heap::destroy() Line 189 + 0x2b bytes C++
    QtScriptd4.dll!QScriptEnginePrivate::~QScriptEngin ePrivate() Line 1029 C++
    QtScriptd4.dll!QScriptEnginePrivate::`scalar deleting destructor'() + 0xfbytes
    QtCored4.dll!QScopedPointerDeleter<QObjectData>::c leanup(QObjectData * pointer=0x09e39a50)
    QtCored4.dll!QScopedPointer<QObjectData,QScopedPoi nterDeleter<QObjectData> >::~QScopedPointer<QObjectData,QScopedPointerDelet er<QObjectData> >() Line 1
    QtCored4.dll!QObject::~QObject() Line 963 + 0x12 bytes C++
    QtScriptd4.dll!QScriptEngine::~QScriptEngine() Line 1980 + 0x9 bytes C++
    MYAPP.exe!QScriptEngine::`scalar deleting destructor'() + 0x2e bytes C++
    MYAPP.exe!MYScriptEng::~MYScriptEng() Line 50 + 0x38 bytes C++
    MYAPP.exe!MYScriptEng::`scalar deleting destructor'() + 0x2b bytes C++
    MYAPP.exe!MyWgt::~MyWgt() Line 84 + 0x3b bytes C++


    Thanks.

  2. #2
    Join Date
    Aug 2011
    Location
    Seoul, Korea
    Posts
    46
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Crash on deletion of QScriptEngine object

    Perhaps you are deleting the object twice somwhow?
    Dong Back Kim

  3. #3
    Join Date
    Jun 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Crash on deletion of QScriptEngine object

    Hi,

    No.I am sure about the deleting.It happening only once.Actually the crash happened when exit the application while debugger is in running state.Is there any method to stop the debugger by code (abortEvaluation is not working).

    Thanks
    -Rajesh

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Crash on deletion of QScriptEngine object

    post the creation, usage and scope of MYScriptEng object

  5. #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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.