Fix invalid memory read when shutting down QML applications
authorSimon Hausmann <simon.hausmann@digia.com>
Thu, 28 Nov 2013 10:00:15 +0000 (11:00 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 29 Nov 2013 08:54:47 +0000 (09:54 +0100)
commit7c029e83a3e5058f7b82efd0235e766952357ffd
treec299996ff3b85c1e173fdcf68e378b9d3b71df3e
parent82a2d28d841c7f59fa76fae6a67e1712a5fb4740
Fix invalid memory read when shutting down QML applications

As the last line in the QObject destructor, we call setParentHelper(0) to
remove ourselves from the parent. In the process of that we also initiate the
QML parentChanged callback. The first thing that parentChanged callback used to
do (but now does it too late, after 26350b5ceafa0ade1328037f6234a7d288eb8f48 in
qtdeclarative) is to check if the object was deleted and then return. We could
re-introduce the check there, but I think it's cleaner to not bother calling
the callback on a dead object in the first place.

Change-Id: Ia4d43b65a9b3744a451b4c312a2d6f9c0e3b67dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/corelib/kernel/qobject.cpp
tests/auto/corelib/kernel/qobject/tst_qobject.cpp