diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2014-11-27 13:27:06 +0100 |
---|---|---|
committer | Albert Astals Cid <albert.astals@canonical.com> | 2014-11-28 09:06:14 +0100 |
commit | e4eb9bfbf74385cb3ee5d7225814be697aa47285 (patch) | |
tree | 9bd7f9638bf2b42e9f5ca91cd1d34e87561e9d8c /src/dbus/qdbusintegrator.cpp | |
parent | 3de7382044cd60ca3bc2d2bfa94d4c4df5466c62 (diff) |
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: Icb61deae272d2f237a4c616fae598404d419af90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index f27d45b142..dd92602dce 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1184,6 +1184,7 @@ void QDBusConnectionPrivate::socketRead(int fd) if (it->watch && it->read && it->read->isEnabled()) { if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_READABLE)) qDebug("OUT OF MEM"); + break; } ++it; } @@ -1198,6 +1199,7 @@ void QDBusConnectionPrivate::socketWrite(int fd) if (it->watch && it->write && it->write->isEnabled()) { if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_WRITABLE)) qDebug("OUT OF MEM"); + break; } ++it; } |