Skip to content

Commit

Permalink
Fix crash when writing property after engine deletion
Browse files Browse the repository at this point in the history
Previously, the engine pointer stored in a QQmlProperty could be
stale due to engine deletion.  This commit ensures we guard that
pointer.

Also reverts cbb7f8b

Task-number: QTBUG-24734
Change-Id: I5349c51fbd19fa46a8710280173c1d224358b96e
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
  • Loading branch information
Chris Adams authored and Qt by Nokia committed Mar 13, 2012
1 parent 340c479 commit fa9fcf2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/qml/qml/qqmlproperty_p.h
Expand Up @@ -54,6 +54,7 @@
//

#include "qqmlproperty.h"
#include "qqmlengine.h"

#include <private/qobject_p.h>
#include <private/qtqmlglobal_p.h>
Expand All @@ -77,7 +78,7 @@ class Q_QML_PRIVATE_EXPORT QQmlPropertyPrivate : public QQmlRefCount
Q_DECLARE_FLAGS(WriteFlags, WriteFlag)

QQmlContextData *context;
QQmlEngine *engine;
QQmlGuard<QQmlEngine> engine;
QQmlGuard<QObject> object;

QQmlPropertyData core;
Expand Down
2 changes: 0 additions & 2 deletions tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
Expand Up @@ -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));
Expand Down

0 comments on commit fa9fcf2

Please sign in to comment.