From cad6ca7700b8525a1b6b558cdf6d5e1538bdc7c0 Mon Sep 17 00:00:00 2001 From: Jonathan Maw Date: Thu, 2 Aug 2012 11:10:49 +0100 Subject: [PATCH] Unregister exported D-Bus objects on finalization Adds unregistration to the following services: * legacy app handler * shutdown client * node startup controller * nsm dummy lifecycle control * nsm dummy consumer --- common/shutdown-client.c | 5 ++++- node-startup-controller/la-handler-service.c | 3 +++ node-startup-controller/node-startup-controller-service.c | 1 + nsm-dummy/nsm-consumer-service.c | 1 + nsm-dummy/nsm-lifecycle-control-service.c | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/common/shutdown-client.c b/common/shutdown-client.c index 9343c40..ea5bc9b 100644 --- a/common/shutdown-client.c +++ b/common/shutdown-client.c @@ -150,7 +150,10 @@ shutdown_client_finalize (GObject *object) /* release the consumer, if we have one */ if (client->consumer != NULL) - g_object_unref (client->consumer); + { + g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (client->consumer)); + g_object_unref (client->consumer); + } (*G_OBJECT_CLASS (shutdown_client_parent_class)->finalize) (object); } diff --git a/node-startup-controller/la-handler-service.c b/node-startup-controller/la-handler-service.c index 4cc9727..32aa007 100644 --- a/node-startup-controller/la-handler-service.c +++ b/node-startup-controller/la-handler-service.c @@ -209,6 +209,9 @@ la_handler_service_finalize (GObject *object) { LAHandlerService *service = LA_HANDLER_SERVICE (object); + /* release the interface skeleton */ + g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (service->interface)); + /* release the bus name */ g_bus_unown_name (service->bus_name_id); diff --git a/node-startup-controller/node-startup-controller-service.c b/node-startup-controller/node-startup-controller-service.c index 5e624e8..a0deaa2 100644 --- a/node-startup-controller/node-startup-controller-service.c +++ b/node-startup-controller/node-startup-controller-service.c @@ -146,6 +146,7 @@ node_startup_controller_service_finalize (GObject *object) g_signal_handlers_disconnect_matched (service->interface, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, service); + g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (service->interface)); g_object_unref (service->interface); /* release the current user context */ diff --git a/nsm-dummy/nsm-consumer-service.c b/nsm-dummy/nsm-consumer-service.c index 11ebd40..1272758 100644 --- a/nsm-dummy/nsm-consumer-service.c +++ b/nsm-dummy/nsm-consumer-service.c @@ -172,6 +172,7 @@ nsm_consumer_service_finalize (GObject *object) g_signal_handlers_disconnect_matched (service->interface, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, service); + g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (service->interface)); g_object_unref (service->interface); /* release the list of shutdown clients */ diff --git a/nsm-dummy/nsm-lifecycle-control-service.c b/nsm-dummy/nsm-lifecycle-control-service.c index 64dfb33..0b30778 100644 --- a/nsm-dummy/nsm-lifecycle-control-service.c +++ b/nsm-dummy/nsm-lifecycle-control-service.c @@ -136,6 +136,7 @@ nsm_lifecycle_control_service_finalize (GObject *object) g_signal_handlers_disconnect_matched (service->interface, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, service); + g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (service->interface)); g_object_unref (service->interface); (*G_OBJECT_CLASS (nsm_lifecycle_control_service_parent_class)->finalize) (object); -- 2.7.4