diff options
author | Francisco Redondo Marchena <francisco.marchena@codethink.co.uk> | 2012-08-06 12:51:53 +0100 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-08-06 14:11:52 +0100 |
commit | 53d25fc8ddba4de1340cad4885ba9fce880bc3fe (patch) | |
tree | f2241bdca2688dc1dde85492ffb9b6c8fe5cbf4c | |
parent | 9d3c6b7b6e02e9f2c28fb9401fd6dcf6f48053da (diff) | |
download | node-startup-controller-53d25fc8ddba4de1340cad4885ba9fce880bc3fe.tar.gz |
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.
-rw-r--r-- | common/shutdown-client.c | 5 |
1 files 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); |