From f587ce7845edb0eb01451368d01b5bc86b5904cd Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 15 Mar 2003 20:47:16 +0000 Subject: 2003-03-15 Havoc Pennington Make it pass the Hello handling test including all OOM codepaths. Now to do other messages... * bus/services.c (bus_service_remove_owner): fix crash when removing owner from an empty list of owners (bus_registry_ensure): don't leave service in the list of a connection's owned services if we fail to put the service in the hash table. * bus/connection.c (bus_connection_preallocate_oom_error): set error flag on the OOM error. * dbus/dbus-connection.c (_dbus_connection_new_for_transport): handle _dbus_transport_set_connection failure * dbus/dbus-transport-unix.c (_dbus_transport_new_for_fd): modify to create watches up front and simply enable/disable them as needed. (unix_connection_set): this can now fail on OOM * dbus/dbus-timeout.c, dbus/dbus-watch.c: add concept of enabling/disabling a watch or timeout. * bus/loop.c (bus_loop_iterate): don't touch disabled watches/timeouts * glib/dbus-gmain.c: adapt to enable/disable watches and timeouts --- dbus/dbus-transport.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'dbus/dbus-transport.c') diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index 03fea75b..8c6c7f1c 100644 --- a/dbus/dbus-transport.c +++ b/dbus/dbus-transport.c @@ -427,8 +427,9 @@ _dbus_transport_handle_watch (DBusTransport *transport, * * @param transport the transport. * @param connection the connection. + * @returns #FALSE if not enough memory */ -void +dbus_bool_t _dbus_transport_set_connection (DBusTransport *transport, DBusConnection *connection) { @@ -438,8 +439,11 @@ _dbus_transport_set_connection (DBusTransport *transport, transport->connection = connection; _dbus_transport_ref (transport); - (* transport->vtable->connection_set) (transport); + if (!(* transport->vtable->connection_set) (transport)) + transport->connection = NULL; _dbus_transport_unref (transport); + + return transport->connection != NULL; } /** -- cgit