diff options
| author | Mårten Nordheim <marten.nordheim@qt.io> | 2022-10-14 12:54:13 +0000 |
|---|---|---|
| committer | Mårten Nordheim <marten.nordheim@qt.io> | 2022-10-17 15:23:54 +0000 |
| commit | e48c0a6e7c081a4209cdcae07c1b577f55bcc515 (patch) | |
| tree | 537142a667f50b221b22a3b3015734bd168c30ad /src/corelib/kernel/qobject.cpp | |
| parent | 0d915623ecef9d81f25c3891101b68384331233d (diff) | |
Revert "QObject: attempt to fix a deadlock introduced by an earlier fix"
This reverts commit 22d4c67234fd152296c3ec98fc57526356a9f62b.
Reason for revert: The fix causes crashes
tst_QObjectRace::disconnectRace2 and we don't currently have a
clear resolution on further fixes.
Task-number: QTBUG-107034
Change-Id: I310c27654f125cdb2939940d432724e73c89f485
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
| -rw-r--r-- | src/corelib/kernel/qobject.cpp | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 6bfa7619db1..6d7079e47f5 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -5311,20 +5311,11 @@ bool QObjectPrivate::disconnect(const QObject *sender, int signal_index, const Q /*! \internal \threadsafe - - Thread-safety warning: this function may be called from any thread and is - thread-safe, \b{so long as the sender is not being deleted}. At the time of - this writing, this function is called from QObject::disconnect() and from - the multiple places where a single-shot connection is activated; in both - cases, the construction of the user code is already such that the sender - object cannot be undergoing deletion in another thread. */ inline bool QObjectPrivate::removeConnection(QObjectPrivate::Connection *c) { if (!c) return false; - - // double-checked locking on this pointer QObject *receiver = c->receiver.loadRelaxed(); if (!receiver) return false; @@ -5345,6 +5336,7 @@ inline bool QObjectPrivate::removeConnection(QObjectPrivate::Connection *c) Q_ASSERT(connections); connections->removeConnection(c); + c->sender->disconnectNotify(QMetaObjectPrivate::signal(c->sender->metaObject(), c->signal_index)); // We must not hold the receiver mutex, else we risk dead-locking; we also only need the sender mutex // It is however vital to hold the senderMutex before calling cleanOrphanedConnections, as otherwise // another thread might modify/delete the connection @@ -5356,8 +5348,6 @@ inline bool QObjectPrivate::removeConnection(QObjectPrivate::Connection *c) locker.dismiss(); // so we dismiss the QOrderedMutexLocker } - // this is safe if the condition in the documentation is correct - c->sender->disconnectNotify(QMetaObjectPrivate::signal(c->sender->metaObject(), c->signal_index)); return true; } |
