[Development] [QML] Singletons are deleted before the other objects
BogDan
bog_dan_ro at yahoo.com
Mon Sep 22 10:33:14 CEST 2014
On Monday 22. September 2014 01.19.17 BogDan wrote:
> Hi Simon,
>
> I took a look and I'm pretty sure I'm right ;-). BTW I'm using 5.4
> branch (sha1 f9ee33f96), is a little bit old, but I bet nobody
> fixed it. The same problem is in previous releases.
>
> So, the singletons are deleted in QQmlEngine::~QQmlEngine():910
> The other active objects are deleted in MemoryManager::sweep(*true*)
> which is called by MemoryManager::~MemoryManager()
> which is called by ExecutionEngine::~ExecutionEngine()
> which is called by QV8Engine::~QV8Engine()
> which is called by QJSEngine::~QJSEngine()
> which is called *after* QQmlEngine::~QQmlEngine()
>
> Check the call-stack:
> 0 MyObject::~MyObject myobject.cpp 44 0x7fffd141eb4b
> 1 MyObject::~MyObject myobject.cpp 46 0x7fffd141ec8a
> 2 (anonymous namespace)::QObjectDeleter::~QObjectDeleter
> qv4qobjectwrapper.cpp 1018 0x7ffff5f79ee1 f9ee33f96f9ee33f96 3
> (anonymous namespace)::QObjectDeleter::~QObjectDeleter
> qv4qobjectwrapper.cpp 1021 0x7ffff5f79f2e 4
> QV4::MemoryManager::sweep qv4mm.cpp 377 0x7ffff5efd080
> 5 QV4::MemoryManager::~MemoryManager qv4mm.cpp 515 0x7ffff5efda18
> 6 QV4::ExecutionEngine::~ExecutionEngine qv4engine.cpp 421
> 0x7ffff5ee4f54 7 QV8Engine::~QV8Engine qv8engine.cpp 116
> 0x7ffff606b7f2
> 8 QV8Engine::~QV8Engine qv8engine.cpp 117 0x7ffff606b87e
> 9 QJSEngine::~QJSEngine qjsengine.cpp 203 0x7ffff5e64b1e
> 10 QQmlEngine::~QQmlEngine qqmlengine.cpp 893 0x7ffff5fb0b5d
> 11 QQmlEngine::~QQmlEngine qqmlengine.cpp 916 0x7ffff5fb0b8c
> 12 QObjectPrivate::deleteChildren qobject.cpp 1943 0x7ffff599efd0
> 13 QObject::~QObject qobject.cpp 1034 0x7ffff599d760
> 14 QWindow::~QWindow qwindow.cpp 210 0x7ffff63f5bdc
> 15 QQuickWindow::~QQuickWindow qquickwindow.cpp 1099 0x7ffff6bc0353
> 16 QQuickView::~QQuickView qquickview.cpp 220 0x7ffff6c9fe35
> 17 main main.cpp 12 0x4021fb
>
> IMHO the sequence from QQmlEngine::~QQmlEngine():910 should be moved
> after/in MemoryManager::~MemoryManager ...
Ahh, so what you're talking about are the _JavaScript_ wrappers for the
singletons, not the singleton objects themselves. That explains the confusion.
Yes, due to the inheritance the final garbage collection runs as the very last
step - and it has to, conceptually. I'm wondering: What code do you have
running at that point that gets still called? Is it code in C++ destructors?
Yes, the code from their destructors needs the singletons objects which are
not available anymore.
Cheers,
BogDan.
More information about the Development
mailing list