summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativedeclarativedata_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qdeclarativedeclarativedata_p.h')
-rw-r--r--src/declarative/qml/qdeclarativedeclarativedata_p.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativedeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h
index 2c92419..ae40130 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;
@@ -117,6 +120,11 @@ public:
template<class T>
void QDeclarativeGuard<T>::addGuard()
{
+ if (QObjectPrivate::get(o)->wasDeleted) {
+ if (prev) remGuard();
+ return;
+ }
+
QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(o, true);
next = data->guards;
if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = &next;