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(+)
|
|
|
1184 | 1184 | if (it->watch && it->read && it->read->isEnabled()) { |
1185 | 1185 | if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_READABLE)) |
1186 | 1186 | qDebug("OUT OF MEM"); |
| 1187 | break; |
1187 | 1188 | } |
1188 | 1189 | ++it; |
1189 | 1190 | } |
… |
… |
|
1198 | 1199 | if (it->watch && it->write && it->write->isEnabled()) { |
1199 | 1200 | if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_WRITABLE)) |
1200 | 1201 | qDebug("OUT OF MEM"); |
| 1202 | break; |
1201 | 1203 | } |
1202 | 1204 | ++it; |
1203 | 1205 | } |