diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-07-27 22:11:36 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-07-27 22:11:36 (GMT) |
commit | 5cda1949899488ce19c4add30a9e0d82326499de (patch) | |
tree | 7d8b0ed091045e3e06a340b781e75663b8ac1d65 /src/declarative/qml/qmlmetaproperty.cpp | |
parent | adc7ac560f6e52167d27ed5d3a3c92e95fb69691 (diff) | |
download | Qt-5cda1949899488ce19c4add30a9e0d82326499de.zip Qt-5cda1949899488ce19c4add30a9e0d82326499de.tar.gz Qt-5cda1949899488ce19c4add30a9e0d82326499de.tar.bz2 |
Fix crashes on exit.
Diffstat (limited to 'src/declarative/qml/qmlmetaproperty.cpp')
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 60b4ac6..3d040e5 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -313,7 +313,7 @@ QmlMetaPropertyPrivate::propertyCategory() const */ const char *QmlMetaProperty::propertyTypeName() const { - if (!d->name.isEmpty()) { + if (!d->name.isEmpty() && d->object) { return d->object->metaObject()->property(d->coreIdx).typeName(); } else { return 0; @@ -415,7 +415,7 @@ bool QmlMetaProperty::isWritable() const { if (propertyCategory() == List || propertyCategory() == QmlList) return true; - else if (!d->name.isEmpty()) + else if (!d->name.isEmpty() && d->object) return d->object->metaObject()->property(d->coreIdx).isWritable(); else if (type() & SignalProperty) return true; @@ -428,7 +428,7 @@ bool QmlMetaProperty::isWritable() const */ bool QmlMetaProperty::isDesignable() const { - if (!d->name.isEmpty()) + if (!d->name.isEmpty() && d->object) return d->object->metaObject()->property(d->coreIdx).isDesignable(); else return false; @@ -475,7 +475,10 @@ QString QmlMetaProperty::name() const */ QMetaProperty QmlMetaProperty::property() const { - return d->object->metaObject()->property(d->coreIdx); + if (d->object) + return d->object->metaObject()->property(d->coreIdx); + else + return QMetaProperty(); } /*! @@ -484,7 +487,7 @@ QMetaProperty QmlMetaProperty::property() const */ QmlBinding *QmlMetaProperty::binding() const { - if (!isProperty() || type() & Attached) + if (!isProperty() || (type() & Attached) || !d->object) return 0; const QObjectList &children = object()->children(); @@ -509,7 +512,7 @@ QmlBinding *QmlMetaProperty::binding() const */ QmlBinding *QmlMetaProperty::setBinding(QmlBinding *binding) const { - if (!isProperty() || type() & Attached) + if (!isProperty() || (type() & Attached) || !d->object) return 0; const QObjectList &children = object()->children(); @@ -577,6 +580,9 @@ QObject *QmlMetaPropertyPrivate::attachedObject() const */ QVariant QmlMetaProperty::read() const { + if (!d->object) + return QVariant(); + if (type() & SignalProperty) { const QObjectList &children = object()->children(); @@ -868,6 +874,9 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value) */ void QmlMetaProperty::write(const QVariant &value) const { + if (!d->object) + return; + QMetaProperty prop = d->object->metaObject()->property(d->coreIdx); if (type() & SignalProperty) { @@ -885,7 +894,7 @@ void QmlMetaProperty::write(const QVariant &value) const */ bool QmlMetaProperty::hasChangedNotifier() const { - if (type() & Property && !(type() & Attached)) { + if (type() & Property && !(type() & Attached) && d->object) { return d->object->metaObject()->property(d->coreIdx).hasNotifySignal(); } return false; @@ -914,7 +923,7 @@ bool QmlMetaProperty::needsChangedNotifier() const */ bool QmlMetaProperty::connectNotifier(QObject *dest, int method) const { - if (!(type() & Property) || type() & Attached) + if (!(type() & Property) || (type() & Attached) || !d->object) return false; QMetaProperty prop = d->object->metaObject()->property(d->coreIdx); @@ -935,7 +944,7 @@ bool QmlMetaProperty::connectNotifier(QObject *dest, int method) const */ bool QmlMetaProperty::connectNotifier(QObject *dest, const char *slot) const { - if (!(type() & Property) || type() & Attached) + if (!(type() & Property) || (type() & Attached) || !d->object) return false; QMetaProperty prop = d->object->metaObject()->property(d->coreIdx); |