Fix QtDeclarative and QtQml co-existence part three ;(
Unfortunately the QObject destroyed callbacks for QtQml and QtDeclarative can't be called in sequence, because if the QQmlData has the ownsMemory bit set, then the destroyed callback will delete the QQmlData, and the sub-sequent call to the destroyed callback of qml1 will try to dereference the QQmlData's first bit (ownedByQml1), which is already destroyed. This patch fixes that by simply sharing the assumption of the first bit indicating module ownership (QtQml vs. QtDeclarative) also to qtbase and using it to distinguish between which destroyed callback function to call. Task-number: QTCREATORBUG-10273 Change-Id: I2773a31a3e9b3a1c22d1c1f33b2f29f3296cb3cf Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>bb10
parent
7972553aca
commit
313a74cc4a
|
|
@ -808,10 +808,13 @@ QObject::~QObject()
|
|||
}
|
||||
|
||||
if (d->declarativeData) {
|
||||
if (QAbstractDeclarativeData::destroyed)
|
||||
QAbstractDeclarativeData::destroyed(d->declarativeData, this);
|
||||
if (QAbstractDeclarativeData::destroyed_qml1)
|
||||
QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this);
|
||||
if (static_cast<QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1) {
|
||||
if (QAbstractDeclarativeData::destroyed_qml1)
|
||||
QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this);
|
||||
} else {
|
||||
if (QAbstractDeclarativeData::destroyed)
|
||||
QAbstractDeclarativeData::destroyed(d->declarativeData, this);
|
||||
}
|
||||
}
|
||||
|
||||
// set ref to zero to indicate that this object has been deleted
|
||||
|
|
|
|||
|
|
@ -97,6 +97,14 @@ public:
|
|||
static bool (*isSignalConnected)(QAbstractDeclarativeData *, const QObject *, int);
|
||||
};
|
||||
|
||||
// This is an implementation of QAbstractDeclarativeData that is identical with
|
||||
// the implementation in QtDeclarative and QtQml for the first bit
|
||||
struct QAbstractDeclarativeDataImpl : public QAbstractDeclarativeData
|
||||
{
|
||||
quint32 ownedByQml1:1;
|
||||
quint32 unused: 31;
|
||||
};
|
||||
|
||||
class Q_CORE_EXPORT QObjectPrivate : public QObjectData
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QObject)
|
||||
|
|
|
|||
Loading…
Reference in New Issue