summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-10-28 19:34:01 -0700
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2014-11-05 10:46:22 +0100
commit73a1e8c60d894701f34806cc4b847aa2814bf389 (patch)
tree141c676a54803673bf1b5a6f5ff870c1371511e9
parenteb99c28861f5e841f306cfe8689627fe0e9bf2e8 (diff)
Partially revert "Fix a deadlock introduced by the race condition fix"5.3
The commit was 9361be58f47ec256bf920c378479a02501219c1f (2008-11-17), referring to the race condition fix that was applied in commit d47c05b1889bb4f06203bbc65f4660b8d0128954 (2008-10-08). The fix for the deadlock reintroduced the race condition and the commit message noted it. The workaround is no longer necessary since we've fixed the original race condition differently now (see the previous two commits). Task-number: QTBUG-42189 Change-Id: I5a83249597a83c4d4caa2ae57964ad3cc61c1d70 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
-rw-r--r--src/dbus/qdbusintegrator.cpp40
1 files changed, 14 insertions, 26 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 39ab797426..ab0aee355d 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1179,41 +1179,29 @@ void QDBusConnectionPrivate::doDispatch()
void QDBusConnectionPrivate::socketRead(int fd)
{
- QVarLengthArray<DBusWatch *, 2> pendingWatches;
-
- {
- QDBusDispatchLocker locker(SocketReadAction, this);
- WatcherHash::ConstIterator it = watchers.constFind(fd);
- while (it != watchers.constEnd() && it.key() == fd) {
- if (it->watch && it->read && it->read->isEnabled())
- pendingWatches.append(it.value().watch);
- ++it;
+ QDBusDispatchLocker locker(SocketReadAction, this);
+ WatcherHash::ConstIterator it = watchers.constFind(fd);
+ while (it != watchers.constEnd() && it.key() == fd) {
+ if (it->watch && it->read && it->read->isEnabled()) {
+ if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_READABLE))
+ qDebug("OUT OF MEM");
}
+ ++it;
}
-
- for (int i = 0; i < pendingWatches.size(); ++i)
- if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_READABLE))
- qDebug("OUT OF MEM");
doDispatch();
}
void QDBusConnectionPrivate::socketWrite(int fd)
{
- QVarLengthArray<DBusWatch *, 2> pendingWatches;
-
- {
- QDBusDispatchLocker locker(SocketWriteAction, this);
- WatcherHash::ConstIterator it = watchers.constFind(fd);
- while (it != watchers.constEnd() && it.key() == fd) {
- if (it->watch && it->write && it->write->isEnabled())
- pendingWatches.append(it.value().watch);
- ++it;
+ QDBusDispatchLocker locker(SocketWriteAction, this);
+ WatcherHash::ConstIterator it = watchers.constFind(fd);
+ while (it != watchers.constEnd() && it.key() == fd) {
+ if (it->watch && it->write && it->write->isEnabled()) {
+ if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_WRITABLE))
+ qDebug("OUT OF MEM");
}
+ ++it;
}
-
- for (int i = 0; i < pendingWatches.size(); ++i)
- if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_WRITABLE))
- qDebug("OUT OF MEM");
}
void QDBusConnectionPrivate::objectDestroyed(QObject *obj)