diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-12-21 03:52:44 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-12-21 04:31:55 (GMT) |
commit | 3468ee1a47bc646fe2af5de38425ee917ea92f59 (patch) | |
tree | 6becffb627acd3ff7dcc2ef95a42aeecfb6809b8 /src/declarative/qml | |
parent | a764a0b5d66e13fb69a5b69330c5edfecf89ee8b (diff) | |
download | Qt-3468ee1a47bc646fe2af5de38425ee917ea92f59.zip Qt-3468ee1a47bc646fe2af5de38425ee917ea92f59.tar.gz Qt-3468ee1a47bc646fe2af5de38425ee917ea92f59.tar.bz2 |
Fix potential crash in PropertyChanges binding rewrite handling.
This fixes the autotest regression for tst_qdeclarativestates::editProperties
introduced by 488e616b50707e5b37162e6d0cfc71a1ffdf9bef.
Reviewed-by: Joona Petrell
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qdeclarativebinding.cpp | 5 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativebinding_p.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 1ead6ce..223d057 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -209,6 +209,8 @@ void QDeclarativeAbstractBinding::setEnabled(bool enabled, QDeclarativePropertyP if (enabled) update(flags); } +QDeclarativeBinding::Identifier QDeclarativeBinding::Invalid = -1; + void QDeclarativeBindingPrivate::refresh() { Q_Q(QDeclarativeBinding); @@ -238,6 +240,9 @@ QDeclarativeBinding * QDeclarativeBinding::createBinding(Identifier id, QObject *obj, QDeclarativeContext *ctxt, const QString &url, int lineNumber, QObject *parent) { + if (id < 0) + return 0; + QDeclarativeContextData *ctxtdata = QDeclarativeContextData::get(ctxt); QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(qmlEngine(obj)); diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index 787a3b9..69931d9 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -163,6 +163,7 @@ public: virtual QString expression() const; typedef int Identifier; + static Identifier Invalid; static QDeclarativeBinding *createBinding(Identifier, QObject *, QDeclarativeContext *, const QString &, int, QObject *parent=0); public Q_SLOTS: |