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.
Re: Crash on deletion of QScriptEngine object
Perhaps you are deleting the object twice somwhow?
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
Re: Crash on deletion of QScriptEngine object
post the creation, usage and scope of MYScriptEng object
Re: Crash on deletion of QScriptEngine object
Code:
bool MYScriptEng::InitEngine()
{
if (m_pEngine==NULL) {
m_pEngine = new QScriptEngine();
}
if (m_bDebugger && m_pDebugger==NULL) {
m_pDebugger = new QScriptEngineDebugger();
m_pDebugger->setAutoShowStandardWindow(true);
m_debugWindow = m_pDebugger->standardWindow();
m_debugWindow->setWindowModality(Qt::ApplicationModal);
m_pDebugger->attachTo(m_pEngine);
}
if (m_pEngine) {
// init the generic functions
m_pEngine->globalObject().setProperty("print", m_pEngine->newFunction(myprint, 1));
m_pEngine->globalObject().setProperty("alert", m_pEngine->newFunction(myalert, 1));
if (m_pMyWgt != NULL) {
QScriptValue MyObj
= m_pEngine
->newQObject
((QObject*)m_pMyWgt
);
m_pEngine->globalObject().setProperty("page", MyObj );
}
m_pEngine->setProcessEventsInterval(100);
}
return true;
}
void MyScriptEng::Init(MyWidget* pWgt)
{
if (m_bDebugger)//If debugger is available
{
m_pDebugger->action(QScriptEngineDebugger::InterruptAction)->trigger();
m_pExitAction= m_pDebugger->action(QScriptEngineDebugger::ContinueAction);
}
if(m_pEngine){
QScriptValue ret = m_pEngine->evaluate(m_strContents);
if (ret.isError()) {
// reportScriptError(ret);
// todo: display error
}
}
}
void MyScriptEng::Deinit()
{
if(m_pEngine){
if(m_pDebugger && m_pDebugger->state()==QScriptEngineDebugger::RunningState)
{
m_pExitAction->trigger();//IS this enough to continue the debugger
m_debugWindow->close();
qApp->processEvents();
}