summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-03-02 09:35:30 (GMT)
committerJesper Thomschutz <jesper.thomschutz@nokia.com>2010-03-05 09:21:53 (GMT)
commitff773613509130141fd9fc02529a32110521f981 (patch)
treea84c396d843d8ef4d7b90557a3c649cb05f36bc6
parent1ac98996285adc059a27a448d565dc6fc64e75cc (diff)
downloadQt-ff773613509130141fd9fc02529a32110521f981.zip
Qt-ff773613509130141fd9fc02529a32110521f981.tar.gz
Qt-ff773613509130141fd9fc02529a32110521f981.tar.bz2
Don't return QDeclarativeDeclarativeData for a deleting object
This was causing crashes in the qmldesigner. (cherry picked from commit 3b8cad8be96d7791e8ca8305609d1155ec093b80)
-rw-r--r--src/declarative/qml/qdeclarativedeclarativedata_p.h5
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/declarative/qml/qdeclarativedeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h
index 2c92419..a7a73bc 100644
--- a/src/declarative/qml/qdeclarativedeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedeclarativedata_p.h
@@ -103,7 +103,10 @@ public:
static QDeclarativeDeclarativeData *get(const QObject *object, bool create = false) {
QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
- if (priv->declarativeData) {
+ if (priv->wasDeleted) {
+ Q_ASSERT(!create);
+ return 0;
+ } else if (priv->declarativeData) {
return static_cast<QDeclarativeDeclarativeData *>(priv->declarativeData);
} else if (create) {
priv->declarativeData = new QDeclarativeDeclarativeData;
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index 0359f98..d3eb583 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -238,7 +238,8 @@ public:
QHash<const QMetaObject *, QDeclarativePropertyCache *> propertyCache;
QDeclarativePropertyCache *cache(QObject *obj) {
Q_Q(QDeclarativeEngine);
- if (!obj || QObjectPrivate::get(obj)->metaObject) return 0;
+ if (!obj || QObjectPrivate::get(obj)->metaObject ||
+ QObjectPrivate::get(obj)->wasDeleted) return 0;
const QMetaObject *mo = obj->metaObject();
QDeclarativePropertyCache *rv = propertyCache.value(mo);
if (!rv) {