summaryrefslogtreecommitdiffstats
path: root/bus/services.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-15 20:47:16 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-15 20:47:16 +0000
commitf587ce7845edb0eb01451368d01b5bc86b5904cd (patch)
treef3a549cd61df701882d818b5fc452b1438097f5b /bus/services.c
parentf05f87a825ab8ed5273674a7f65521ffc526f0d2 (diff)
2003-03-15 Havoc Pennington <hp@pobox.com>
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
Diffstat (limited to 'bus/services.c')
-rw-r--r--bus/services.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/bus/services.c b/bus/services.c
index 9508b2f7..92f6cdf4 100644
--- a/bus/services.c
+++ b/bus/services.c
@@ -170,6 +170,8 @@ bus_registry_ensure (BusRegistry *registry,
service->name,
service))
{
+ bus_connection_remove_owned_service (owner_if_created,
+ service);
_dbus_list_clear (&service->owners);
dbus_free (service->name);
_dbus_mem_pool_dealloc (registry->service_pool, service);
@@ -290,7 +292,11 @@ bus_service_remove_owner (BusService *service,
return FALSE;
}
- if (_dbus_list_length_is_one (&service->owners))
+ if (service->owners == NULL)
+ {
+ _dbus_assert_not_reached ("Tried to remove owner of a service that has no owners");
+ }
+ else if (_dbus_list_length_is_one (&service->owners))
{
/* We are the only owner - send service deleted */
if (!bus_driver_send_service_deleted (service->name,
@@ -301,6 +307,7 @@ bus_service_remove_owner (BusService *service,
{
DBusList *link;
link = _dbus_list_get_first (&service->owners);
+ _dbus_assert (link != NULL);
link = _dbus_list_get_next_link (&service->owners, link);
if (link != NULL)
@@ -320,7 +327,8 @@ bus_service_remove_owner (BusService *service,
if (service->owners == NULL)
{
/* Delete service (already sent message that it was deleted above) */
- _dbus_hash_table_remove_string (service->registry->service_hash, service->name);
+ _dbus_hash_table_remove_string (service->registry->service_hash,
+ service->name);
dbus_free (service->name);
_dbus_mem_pool_dealloc (service->registry->service_pool, service);