Ticket #46496: Partially-revert-Fix-a-deadlock-introduced-by-the-ra.patch

File Partially-revert-Fix-a-deadlock-introduced-by-the-ra.patch, 3.3 KB (added by RJVB (René Bertin), 10 years ago)

from Ubuntu

  • qtbase/src/dbus/qdbusintegrator.cpp

    From 73a1e8c60d894701f34806cc4b847aa2814bf389 Mon Sep 17 00:00:00 2001
    From: Thiago Macieira <thiago.macieira@intel.com>
    Date: Tue, 28 Oct 2014 19:34:01 -0700
    Subject: [PATCH 3/3] Partially revert "Fix a deadlock introduced by the race
     condition fix"
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    
    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>
    ---
     src/dbus/qdbusintegrator.cpp | 40 ++++++++++++++--------------------------
     1 file changed, 14 insertions(+), 26 deletions(-)
    
     
    11791179
    11801180void QDBusConnectionPrivate::socketRead(int fd)
    11811181{
    1182     QVarLengthArray<DBusWatch *, 2> pendingWatches;
    1183 
    1184     {
    1185         QDBusDispatchLocker locker(SocketReadAction, this);
    1186         WatcherHash::ConstIterator it = watchers.constFind(fd);
    1187         while (it != watchers.constEnd() && it.key() == fd) {
    1188             if (it->watch && it->read && it->read->isEnabled())
    1189                 pendingWatches.append(it.value().watch);
    1190             ++it;
     1182    QDBusDispatchLocker locker(SocketReadAction, this);
     1183    WatcherHash::ConstIterator it = watchers.constFind(fd);
     1184    while (it != watchers.constEnd() && it.key() == fd) {
     1185        if (it->watch && it->read && it->read->isEnabled()) {
     1186            if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_READABLE))
     1187                qDebug("OUT OF MEM");
    11911188        }
     1189        ++it;
    11921190    }
    1193 
    1194     for (int i = 0; i < pendingWatches.size(); ++i)
    1195         if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_READABLE))
    1196             qDebug("OUT OF MEM");
    11971191    doDispatch();
    11981192}
    11991193
    12001194void QDBusConnectionPrivate::socketWrite(int fd)
    12011195{
    1202     QVarLengthArray<DBusWatch *, 2> pendingWatches;
    1203 
    1204     {
    1205         QDBusDispatchLocker locker(SocketWriteAction, this);
    1206         WatcherHash::ConstIterator it = watchers.constFind(fd);
    1207         while (it != watchers.constEnd() && it.key() == fd) {
    1208             if (it->watch && it->write && it->write->isEnabled())
    1209                 pendingWatches.append(it.value().watch);
    1210             ++it;
     1196    QDBusDispatchLocker locker(SocketWriteAction, this);
     1197    WatcherHash::ConstIterator it = watchers.constFind(fd);
     1198    while (it != watchers.constEnd() && it.key() == fd) {
     1199        if (it->watch && it->write && it->write->isEnabled()) {
     1200            if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_WRITABLE))
     1201                qDebug("OUT OF MEM");
    12111202        }
     1203        ++it;
    12121204    }
    1213 
    1214     for (int i = 0; i < pendingWatches.size(); ++i)
    1215         if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_WRITABLE))
    1216             qDebug("OUT OF MEM");
    12171205}
    12181206
    12191207void QDBusConnectionPrivate::objectDestroyed(QObject *obj)