diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-04-14 17:02:48 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-09-15 02:08:26 +0000 |
commit | 2e12f6e63ddb1ea3c79660cd99ffb96d4cd0bd82 (patch) | |
tree | b4c780043f0ff25f574c91dd97151c670d4107f2 /src/dbus/qdbusintegrator.cpp | |
parent | 8132cb655ad9f1479110d20c4f31f32a9da094d9 (diff) |
Fix deadlock if the last reference is dropped during delivery
We increase the reference count of the connection during delivery of an
incoming message, so it's possible that the corresponding deref will
drop the last reference to the connection: another thread may have
called disconnectFromBus/Peer. However, during destruction we try to
drain the incoming socket queue, so we need to acquire the dispatch lock
again.
The solution is to always use deleteLater(), which means the
deleteYourself() function is unnecessary.
Change-Id: I27eaacb532114dd188c4ffff13d507039fcf7b6a
Reviewed-by: Albert Astals Cid <aacid@kde.org>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 22c1a3e363..796f41bffc 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1065,20 +1065,6 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate() server = 0; } -void QDBusConnectionPrivate::deleteYourself() -{ - if (thread() && thread() != QThread::currentThread()) { - // last reference dropped while not in the correct thread - // ask the correct thread to delete - - // note: since we're posting an event to another thread, we - // must consider deleteLater() to take effect immediately - deleteLater(); - } else { - delete this; - } -} - void QDBusConnectionPrivate::closeConnection() { QDBusWriteLocker locker(CloseConnectionAction, this); |