diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-08 03:58:04 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-08 04:02:58 (GMT) |
commit | 7a092995df36cf5ae380bbebb2828ad468072efc (patch) | |
tree | 576da5d4d234178da1c67cc527b5de8bc66222ea /src/declarative | |
parent | fdee72baa6c64d9fdf7d660da24899016a15134f (diff) | |
download | Qt-7a092995df36cf5ae380bbebb2828ad468072efc.zip Qt-7a092995df36cf5ae380bbebb2828ad468072efc.tar.gz Qt-7a092995df36cf5ae380bbebb2828ad468072efc.tar.bz2 |
Initialize QDeclarativeData even when not using a QDeclarativeEngine
Caused crashes in various test cases
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qdeclarativedeclarativedata_p.h | 12 | ||||
-rw-r--r-- | 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<QString, QString> 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<QDeclarativeDeclarativeData *>(d)->destroyed(o); } -static void QDeclarativeDeclarativeData_parentChanged(QDeclarativeData *d, QObject *o, QObject *p) +void QDeclarativeDeclarativeData::parentChanged(QDeclarativeData *d, QObject *o, QObject *p) { static_cast<QDeclarativeDeclarativeData *>(d)->parentChanged(o, p); } @@ -363,8 +363,7 @@ void QDeclarativeEnginePrivate::init() qRegisterMetaType<QDeclarativeScriptString>("QDeclarativeScriptString"); qRegisterMetaType<QScriptValue>("QScriptValue"); - QDeclarativeData::destroyed = QDeclarativeDeclarativeData_destroyed; - QDeclarativeData::parentChanged = QDeclarativeDeclarativeData_parentChanged; + QDeclarativeDeclarativeData::init(); contextClass = new QDeclarativeContextScriptClass(q); objectClass = new QDeclarativeObjectScriptClass(q); |