From 7a092995df36cf5ae380bbebb2828ad468072efc Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 13:58:04 +1000 Subject: Initialize QDeclarativeData even when not using a QDeclarativeEngine Caused crashes in various test cases --- src/declarative/qml/qdeclarativedeclarativedata_p.h | 12 +++++++++++- src/declarative/qml/qdeclarativeengine.cpp | 7 +++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/declarative/qml/qdeclarativedeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h index 87c5c9c..5b12629 100644 --- a/src/declarative/qml/qdeclarativedeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedeclarativedata_p.h @@ -75,7 +75,17 @@ public: : ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false), context(0), outerContext(0), bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), - attachedProperties(0), scriptValue(0), propertyCache(0), guards(0) {} + attachedProperties(0), scriptValue(0), propertyCache(0), guards(0) { + init(); + } + + static inline void init() { + QDeclarativeData::destroyed = destroyed; + QDeclarativeData::parentChanged = parentChanged; + } + + static void destroyed(QDeclarativeData *, QObject *); + static void parentChanged(QDeclarativeData *, QObject *, QObject *); void destroyed(QObject *); void parentChanged(QObject *, QObject *); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index f5fe140..44437ea 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -346,12 +346,12 @@ typedef QMap StringStringMap; Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri -static void QDeclarativeDeclarativeData_destroyed(QDeclarativeData *d, QObject *o) +void QDeclarativeDeclarativeData::destroyed(QDeclarativeData *d, QObject *o) { static_cast(d)->destroyed(o); } -static void QDeclarativeDeclarativeData_parentChanged(QDeclarativeData *d, QObject *o, QObject *p) +void QDeclarativeDeclarativeData::parentChanged(QDeclarativeData *d, QObject *o, QObject *p) { static_cast(d)->parentChanged(o, p); } @@ -363,8 +363,7 @@ void QDeclarativeEnginePrivate::init() qRegisterMetaType("QDeclarativeScriptString"); qRegisterMetaType("QScriptValue"); - QDeclarativeData::destroyed = QDeclarativeDeclarativeData_destroyed; - QDeclarativeData::parentChanged = QDeclarativeDeclarativeData_parentChanged; + QDeclarativeDeclarativeData::init(); contextClass = new QDeclarativeContextScriptClass(q); objectClass = new QDeclarativeObjectScriptClass(q); -- cgit v0.12