Ticket #46536: Break-after-handling-the-read-write.patch

File Break-after-handling-the-read-write.patch, 1.2 KB (added by RJVB (René Bertin), 10 years ago)
  • qtbase/src/dbus/qdbusintegrator.cpp

    From 2a733b9bf62df746fb538d37ba1b150ada70c0b0 Mon Sep 17 00:00:00 2001
    From: Albert Astals Cid <albert.astals@canonical.com>
    Date: Thu, 27 Nov 2014 13:27:06 +0100
    Subject: [PATCH] Break after handling the read/write
    
    The loop is there because watchers may have two Watcher for the same
    fd, one for read and one for write, but after we're processed the
    correct one we don't need to keep looping.
    
    This fixes a crash since it's possible that while in processing
    q_dbus_watch_handle we get a watch added/remove this invalidating
    the iterator and crashing
    
    Change-Id: Icb61deae272d2f237a4c616fae598404d419df90
    ---
     src/dbus/qdbusintegrator.cpp | 2 ++
     1 file changed, 2 insertions(+)
    
     
    11841184        if (it->watch && it->read && it->read->isEnabled()) {
    11851185            if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_READABLE))
    11861186                qDebug("OUT OF MEM");
     1187            break;
    11871188        }
    11881189        ++it;
    11891190    }
     
    11981199        if (it->watch && it->write && it->write->isEnabled()) {
    11991200            if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_WRITABLE))
    12001201                qDebug("OUT OF MEM");
     1202            break;
    12011203        }
    12021204        ++it;
    12031205    }