diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-01-21 18:51:27 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-06-13 15:45:54 +0100 |
commit | 58f968a2cc700377fc668dcaed4bc94a2ea7ca88 (patch) | |
tree | a9f63e16ff92a316a9a741cc348d576daec6de62 /dbus/dbus-transport-socket.c | |
parent | a2e330980d6b7975dfea5b7d798e9bd55b80241c (diff) | |
download | dbus-58f968a2cc700377fc668dcaed4bc94a2ea7ca88.tar.gz |
Always remove, invalidate and free watches before closing watched sockets
This should mean we don't get invalid fds in the main loop.
The BSD (kqueue) and Windows code paths are untested, but follow the same
patterns as the tested Linux/generic Unix versions.
DBusTransportSocket was already OK (it called free_watches() before
_dbus_close_socket, and that did the remove, invalidate, unref dance).
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
Diffstat (limited to 'dbus/dbus-transport-socket.c')
-rw-r--r-- | dbus/dbus-transport-socket.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/dbus/dbus-transport-socket.c b/dbus/dbus-transport-socket.c index 1d4c2bf7..1dfb1408 100644 --- a/dbus/dbus-transport-socket.c +++ b/dbus/dbus-transport-socket.c @@ -1278,8 +1278,10 @@ _dbus_transport_new_for_socket (int fd, return (DBusTransport*) socket_transport; failed_4: + _dbus_watch_invalidate (socket_transport->read_watch); _dbus_watch_unref (socket_transport->read_watch); failed_3: + _dbus_watch_invalidate (socket_transport->write_watch); _dbus_watch_unref (socket_transport->write_watch); failed_2: _dbus_string_free (&socket_transport->encoded_incoming); |