Ticket #46496: 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)

from Ubuntu

  • 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(+)
    
     
    11851185        if (it->watch && it->read && it->read->isEnabled()) {
    11861186            if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_READABLE))
    11871187                qDebug("OUT OF MEM");
     1188            break;
    11881189        }
    11891190        ++it;
    11901191    }
     
    11991200        if (it->watch && it->write && it->write->isEnabled()) {
    12001201            if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_WRITABLE))
    12011202                qDebug("OUT OF MEM");
     1203            break;
    12021204        }
    12031205        ++it;
    12041206    }