0 ~
QObject qobject.
cpp 954 0x6a20d95b
1 ~MainWindow mainwindow.cpp 166 0x00402d25
2 ~QObjectDelegate qscriptqobject.cpp 1156 0x0a5d2f70
3 ~Data qscriptobject.cpp 42 0x0a5cadea
4 ~QScriptObject qscriptobject.cpp 52 0x0a5caf11
5 QTJSC::Heap::sweep<(QTJSC::HeapType)0> Collector.cpp 1156 0x0a614e8f
6 QTJSC::Heap::destroy Collector.cpp 199 0x0a5530f7
7 ~QScriptEnginePrivate qscriptengine.cpp 838 0x0a5b6277
8 QScopedPointerDeleter<QObjectData>::cleanup qscopedpointer.h 62 0x6a267efe
9 ~QScopedPointer qscopedpointer.h 100 0x6a25e701
10 ~
QObject qobject.
cpp 992 0x6a20cfd0
11 ~QScriptEngine qscriptengine.cpp 1488 0x0a5b8d94
12 ~MainWindow mainwindow.cpp 166 0x00402a75
13 qMain main.cpp 9 0x0040140d
14 WinMain@16 qtmain_win.cpp 131 0x0046da72
15 main 0 0x0046d798
0 ~QObject qobject.cpp 954 0x6a20d95b
1 ~MainWindow mainwindow.cpp 166 0x00402d25
2 ~QObjectDelegate qscriptqobject.cpp 1156 0x0a5d2f70
3 ~Data qscriptobject.cpp 42 0x0a5cadea
4 ~QScriptObject qscriptobject.cpp 52 0x0a5caf11
5 QTJSC::Heap::sweep<(QTJSC::HeapType)0> Collector.cpp 1156 0x0a614e8f
6 QTJSC::Heap::destroy Collector.cpp 199 0x0a5530f7
7 ~QScriptEnginePrivate qscriptengine.cpp 838 0x0a5b6277
8 QScopedPointerDeleter<QObjectData>::cleanup qscopedpointer.h 62 0x6a267efe
9 ~QScopedPointer qscopedpointer.h 100 0x6a25e701
10 ~QObject qobject.cpp 992 0x6a20cfd0
11 ~QScriptEngine qscriptengine.cpp 1488 0x0a5b8d94
12 ~MainWindow mainwindow.cpp 166 0x00402a75
13 qMain main.cpp 9 0x0040140d
14 WinMain@16 qtmain_win.cpp 131 0x0046da72
15 main 0 0x0046d798
To copy to clipboard, switch view to plain text mode
Looking at this again I had an idea...
As you can see, the destructor of MainWindow appears twice in the stack backtrace. Then I realized that I'm wrapping the MainWindow object in a ScriptValue:
QScriptValue scriptMainWnd = engine->newQObject(mainWnd, QScriptEngine::ScriptOwnership);
QScriptValue scriptMainWnd = engine->newQObject(mainWnd, QScriptEngine::ScriptOwnership);
To copy to clipboard, switch view to plain text mode
Does the destructor of QScriptEngine also delete all the objects connected to its QScriptValues? Then of course this would make perfect sense, since the destruction of the QScriptEngine would yield the destruction of the MainWindow. But that's just a wild guess...
Cheers,
Tim
Bookmarks