From 7c029e83a3e5058f7b82efd0235e766952357ffd Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 28 Nov 2013 11:00:15 +0100 Subject: 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 --- src/corelib/kernel/qobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/kernel/qobject.cpp') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index e062a38185..f8664ba3a2 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1876,7 +1876,7 @@ void QObjectPrivate::setParent_helper(QObject *o) } } } - if (!isDeletingChildren && declarativeData && QAbstractDeclarativeData::parentChanged) + if (!wasDeleted && !isDeletingChildren && declarativeData && QAbstractDeclarativeData::parentChanged) QAbstractDeclarativeData::parentChanged(declarativeData, q, o); } -- cgit v1.2.3