diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-11-25 10:29:45 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-26 17:26:49 +0100 |
commit | 2866c00375313d1726cc0473b6b7bfc87b984c78 (patch) | |
tree | b29a10d1fb3238c824b5bbaf0dd6df6e12e8cd9d /src/declarative/qml | |
parent | d9ed35f95835def9e3201719d986b56c01b160a2 (diff) | |
download | qtquick1-2866c00375313d1726cc0473b6b7bfc87b984c78.tar.gz |
Allow QtDeclarative and QtQml to co-exist at run-timev5.2.0
This patch changes QDeclarativeData to share the very first bit with QtQml's
QQmlData, to indicate ownership by either run-time. We need to check the bit in
the only QObject callback we use (destroyed), the other callback was unused and
removed.
Task-number: QTBUG-35006
Change-Id: Ife4b515648cba42b91612736ccd9375f1f46808a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qdeclarativedata_p.h | 9 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 12 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativevme.cpp | 1 |
3 files changed, 9 insertions, 13 deletions
diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h index 9c629ef3..b2d7eb90 100644 --- a/src/declarative/qml/qdeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedata_p.h @@ -74,7 +74,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeData : public QAbstractDeclarativeData { public: QDeclarativeData() - : ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false), + : ownedByQml1(true), 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), scriptValue(0), objectDataRefCount(0), propertyCache(0), guards(0), extendedData(0) { @@ -82,12 +82,10 @@ public: } static inline void init() { - QAbstractDeclarativeData::destroyed = destroyed; - QAbstractDeclarativeData::parentChanged = parentChanged; + QAbstractDeclarativeData::destroyed_qml1 = destroyed; } static void destroyed(QAbstractDeclarativeData *, QObject *); - static void parentChanged(QAbstractDeclarativeData *, QObject *, QObject *); void destroyed(QObject *); @@ -95,11 +93,12 @@ public: if (!explicitIndestructibleSet) indestructible = false; } + quint32 ownedByQml1:1; // This bit is shared with QML2's QQmlData. quint32 ownMemory:1; quint32 ownContext:1; quint32 indestructible:1; quint32 explicitIndestructibleSet:1; - quint32 dummy:28; + quint32 dummy:27; // The context that created the C++ object QDeclarativeContextData *context; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index fe33cc3d..a42c6a04 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -556,14 +556,10 @@ void QDeclarativePrivate::qdeclarativeelement_destructor(QObject *o) void QDeclarativeData::destroyed(QAbstractDeclarativeData *d, QObject *o) { - static_cast<QDeclarativeData *>(d)->destroyed(o); -} - -void QDeclarativeData::parentChanged(QAbstractDeclarativeData *d, QObject *o, QObject *p) -{ - Q_UNUSED(d) - Q_UNUSED(o) - Q_UNUSED(p) + QDeclarativeData *ddata = static_cast<QDeclarativeData *>(d); + if (!ddata->ownedByQml1) + return; + ddata->destroyed(o); } void QDeclarativeEnginePrivate::init() diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index c4be742c..45c3f1b5 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -287,6 +287,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEObjectStack &stack, instr.createSimple.create(o); QDeclarativeData *ddata = (QDeclarativeData *)(((const char *)o) + instr.createSimple.typeSize); + ddata->ownedByQml1 = true; const QDeclarativeCompiledData::TypeReference &ref = types.at(instr.createSimple.type); if (!ddata->propertyCache && ref.typePropertyCache) { ddata->propertyCache = ref.typePropertyCache; |