From 86e9e61cadd0f5bcdbd466eb21dfc363a1fedb6d Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Thu, 4 Mar 2021 16:08:49 +0100 Subject: QQmlData: Remove parentChanged code The code which set parentFrozen is gone since 5ece9dc613bf12322753b18fe6b8da726b74ad33, lost in the migration from VME to V4. Judging by an old mailing list post (https://development.qt-project.narkive.com/6ygwVMAh/improving-qtquick-internals-was-re-qml-engine-changes#post8) too much would break if that check were actually enabled (which is probably the reason why this code started to bit-rot). Task-number: QTBUG-82931 Change-Id: Ibdc68957c6adf6198f6c59b65e19e78a66039f00 Reviewed-by: Ulf Hermann --- src/qml/qml/qqmldata_p.h | 7 ++----- src/qml/qml/qqmlengine.cpp | 26 +------------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h index a1a4b585d4..ed77c1851b 100644 --- a/src/qml/qml/qqmldata_p.h +++ b/src/qml/qml/qqmldata_p.h @@ -98,7 +98,7 @@ public: if (!initialized) { initialized = true; QAbstractDeclarativeData::destroyed = destroyed; - QAbstractDeclarativeData::parentChanged = parentChanged; + QAbstractDeclarativeData::parentChanged = nullptr; QAbstractDeclarativeData::signalEmitted = signalEmitted; QAbstractDeclarativeData::receivers = receivers; QAbstractDeclarativeData::isSignalConnected = isSignalConnected; @@ -106,13 +106,11 @@ public: } static void destroyed(QAbstractDeclarativeData *, QObject *); - static void parentChanged(QAbstractDeclarativeData *, QObject *, QObject *); static void signalEmitted(QAbstractDeclarativeData *, QObject *, int, void **); static int receivers(QAbstractDeclarativeData *, const QObject *, int); static bool isSignalConnected(QAbstractDeclarativeData *, const QObject *, int); void destroyed(QObject *); - void parentChanged(QObject *, QObject *); void setImplicitDestructible() { if (!explicitIndestructibleSet) indestructible = false; @@ -141,8 +139,7 @@ public: // set when at least one of the object's properties is intercepted quint32 hasInterceptorMetaObject:1; quint32 hasVMEMetaObject:1; - quint32 parentFrozen:1; - quint32 dummy:7; + quint32 dummy:8; // When bindingBitsSize < sizeof(ptr), we store the binding bit flags inside // bindingBitsValue. When we need more than sizeof(ptr) bits, we allocated diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index dfcb336b55..e8604060b9 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -653,7 +653,7 @@ void QQmlPrivate::qdeclarativeelement_destructor(QObject *o) QQmlData::QQmlData() : ownMemory(true), indestructible(true), explicitIndestructibleSet(false), hasTaintedV4Object(false), isQueuedForDeletion(false), rootObjectInCreation(false), - hasInterceptorMetaObject(false), hasVMEMetaObject(false), parentFrozen(false), + hasInterceptorMetaObject(false), hasVMEMetaObject(false), bindingBitsArraySize(InlineBindingArraySize), notifyList(nullptr), bindings(nullptr), signalHandlers(nullptr), nextContextObject(nullptr), prevContextObject(nullptr), lineNumber(0), columnNumber(0), jsEngineId(0), @@ -673,11 +673,6 @@ void QQmlData::destroyed(QAbstractDeclarativeData *d, QObject *o) ddata->destroyed(o); } -void QQmlData::parentChanged(QAbstractDeclarativeData *d, QObject *o, QObject *p) -{ - QQmlData *ddata = static_cast(d); - ddata->parentChanged(o, p); -} class QQmlThreadNotifierProxyObject : public QObject { @@ -1699,25 +1694,6 @@ void QQmlData::destroyed(QObject *object) this->~QQmlData(); } -DEFINE_BOOL_CONFIG_OPTION(parentTest, QML_PARENT_TEST); - -void QQmlData::parentChanged(QObject *object, QObject *parent) -{ - if (parentTest()) { - if (parentFrozen && !QObjectPrivate::get(object)->wasDeleted) { - QString on; - QString pn; - - { QDebug dbg(&on); dbg << object; on = on.left(on.length() - 1); } - { QDebug dbg(&pn); dbg << parent; pn = pn.left(pn.length() - 1); } - - qFatal("Object %s has had its parent frozen by QML and cannot be changed.\n" - "User code is attempting to change it to %s.\n" - "This behavior is NOT supported!", qPrintable(on), qPrintable(pn)); - } - } -} - QQmlData::BindingBitsType *QQmlData::growBits(QObject *obj, int bit) { BindingBitsType *bits = (bindingBitsArraySize == InlineBindingArraySize) ? bindingBitsValue : bindingBits; -- cgit v1.2.3