diff options
| author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-06-13 12:16:26 +0200 |
|---|---|---|
| committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-07-14 19:34:46 +0200 |
| commit | 2c81ba2df95cc07d5d147c8f3c7999c34848d274 (patch) | |
| tree | 6924ccb7737e3d756699e606c91b4f8253f1f764 /src/corelib/kernel/qobject.cpp | |
| parent | 6db91c0df1900df2ddcd5abeb243b8852b02b7ab (diff) | |
QThread: Clean up bindingStatusOrList if object gets deleted
Deal with the case that the object gets deleted between a call to
moveToThread and the start of the thread by removing the object from the
list in that case.
Fixes: QTBUG-104014
Pick-to: 6.4
Change-Id: Ib249b6e8e8dfbc4d1332bb99a57fa9d3cff16465
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
| -rw-r--r-- | src/corelib/kernel/qobject.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index e3f686d3dea..e07631d0015 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -970,6 +970,16 @@ QObject::~QObject() d->wasDeleted = true; d->blockSig = 0; // unblock signals so we always emit destroyed() + if (!d->bindingStorage.isValid()) { + // this might be the case after an incomplete thread-move + // remove this object from the pending list in that case + if (QThread *ownThread = thread()) { + auto *privThread = static_cast<QThreadPrivate *>( + QObjectPrivate::get(ownThread)); + privThread->removeObjectWithPendingBindingStatusChange(this); + } + } + // If we reached this point, we need to clear the binding data // as the corresponding properties are no longer useful d->clearBindingStorage(); |
