From: Chris Adams Date: Mon, 12 Mar 2012 01:54:11 +0000 (+1000) Subject: Fix crash when writing property after engine deletion X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=fa9fcf2fb259b1b3eb09e0c853075ca328e930c5;p=konrad%2Fqtdeclarative.git Fix crash when writing property after engine deletion Previously, the engine pointer stored in a QQmlProperty could be stale due to engine deletion. This commit ensures we guard that pointer. Also reverts cbb7f8b10e99fad675839d7625d3236ed67b3e01 Task-number: QTBUG-24734 Change-Id: I5349c51fbd19fa46a8710280173c1d224358b96e Reviewed-by: Michael Brasser --- diff --git a/src/qml/qml/qqmlproperty_p.h b/src/qml/qml/qqmlproperty_p.h index 0f97a63..dc02355 100644 --- a/src/qml/qml/qqmlproperty_p.h +++ b/src/qml/qml/qqmlproperty_p.h @@ -54,6 +54,7 @@ // #include "qqmlproperty.h" +#include "qqmlengine.h" #include #include @@ -77,7 +78,7 @@ public: Q_DECLARE_FLAGS(WriteFlags, WriteFlag) QQmlContextData *context; - QQmlEngine *engine; + QQmlGuard engine; QQmlGuard object; QQmlPropertyData core; diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 13ea1ab..ae30090 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -1553,8 +1553,6 @@ void tst_qqmlproperty::crashOnValueProperty() delete engine; engine = 0; - QSKIP("QTBUG-24734: test accesses deleted QML engine from QQmlProperty::propertyTypeName()"); - QCOMPARE(p.propertyTypeName(), "int"); QCOMPARE(p.read(), QVariant(10)); p.write(QVariant(20));