From 53d25fc8ddba4de1340cad4885ba9fce880bc3fe Mon Sep 17 00:00:00 2001 From: Francisco Redondo Marchena Date: Mon, 6 Aug 2012 12:51:53 +0100 Subject: Add a type check to avoid a proxy to skeleton cast to fail We use the "consumer" property of the ShutdownClient class to store a proxy in the NSC code and a skeleton in the NSM dummy code. When releasing the consumer in shutdown_client_finalize(), we may therefor not cast to a ShutdownConsumerSkeleton unconditionally; otherwise the NSM dummy will segfault when releasing ShutdownClient objects. --- common/shutdown-client.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/shutdown-client.c b/common/shutdown-client.c index ea5bc9b..6df5138 100644 --- a/common/shutdown-client.c +++ b/common/shutdown-client.c @@ -151,8 +151,9 @@ shutdown_client_finalize (GObject *object) /* release the consumer, if we have one */ if (client->consumer != NULL) { - g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (client->consumer)); - g_object_unref (client->consumer); + if (IS_SHUTDOWN_CONSUMER_SKELETON (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); -- cgit v1.2.1