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