|
|
8c8af5 |
From 07a4f0c0c2e252f8975039a4320d69d04200ac31 Mon Sep 17 00:00:00 2001
|
|
|
8c8af5 |
From: "Zeeshan Ali (Khattak)" <zeeshanak@gnome.org>
|
|
|
8c8af5 |
Date: Thu, 6 Nov 2014 18:32:28 +0000
|
|
|
8c8af5 |
Subject: [PATCH 1/7] service-client: Gracefully handle NULL agent
|
|
|
8c8af5 |
|
|
|
8c8af5 |
Don't connect to signals on agent if its NULL. Agent is currently
|
|
|
8c8af5 |
entirely optional.
|
|
|
8c8af5 |
---
|
|
|
8c8af5 |
src/gclue-service-client.c | 23 +++++++++++++++--------
|
|
|
8c8af5 |
1 file changed, 15 insertions(+), 8 deletions(-)
|
|
|
8c8af5 |
|
|
|
8c8af5 |
diff --git a/src/gclue-service-client.c b/src/gclue-service-client.c
|
|
|
8c8af5 |
index c27faac..0ff3e85 100644
|
|
|
8c8af5 |
--- a/src/gclue-service-client.c
|
|
|
8c8af5 |
+++ b/src/gclue-service-client.c
|
|
|
8c8af5 |
@@ -385,7 +385,11 @@ gclue_service_client_handle_start (GClueClient *client,
|
|
|
8c8af5 |
return TRUE;
|
|
|
8c8af5 |
}
|
|
|
8c8af5 |
|
|
|
8c8af5 |
- max_accuracy = gclue_agent_get_max_accuracy_level (priv->agent_proxy);
|
|
|
8c8af5 |
+ if (priv->agent_proxy != NULL)
|
|
|
8c8af5 |
+ max_accuracy = gclue_agent_get_max_accuracy_level (priv->agent_proxy);
|
|
|
8c8af5 |
+ else
|
|
|
8c8af5 |
+ max_accuracy = GCLUE_ACCURACY_LEVEL_EXACT;
|
|
|
8c8af5 |
+
|
|
|
8c8af5 |
if (max_accuracy == 0) {
|
|
|
8c8af5 |
g_dbus_method_invocation_return_error (invocation,
|
|
|
8c8af5 |
G_DBUS_ERROR,
|
|
|
8c8af5 |
@@ -429,9 +433,11 @@ gclue_service_client_finalize (GObject *object)
|
|
|
8c8af5 |
|
|
|
8c8af5 |
g_clear_pointer (&priv->path, g_free);
|
|
|
8c8af5 |
g_clear_object (&priv->connection);
|
|
|
8c8af5 |
- g_signal_handlers_disconnect_by_func (priv->agent_proxy,
|
|
|
8c8af5 |
- G_CALLBACK (on_agent_props_changed),
|
|
|
8c8af5 |
- object);
|
|
|
8c8af5 |
+ if (priv->agent_proxy != NULL)
|
|
|
8c8af5 |
+ g_signal_handlers_disconnect_by_func
|
|
|
8c8af5 |
+ (priv->agent_proxy,
|
|
|
8c8af5 |
+ G_CALLBACK (on_agent_props_changed),
|
|
|
8c8af5 |
+ object);
|
|
|
8c8af5 |
g_clear_object (&priv->agent_proxy);
|
|
|
8c8af5 |
g_clear_object (&priv->locator);
|
|
|
8c8af5 |
g_clear_object (&priv->location);
|
|
|
8c8af5 |
@@ -495,10 +501,11 @@ gclue_service_client_set_property (GObject *object,
|
|
|
8c8af5 |
|
|
|
8c8af5 |
case PROP_AGENT_PROXY:
|
|
|
8c8af5 |
client->priv->agent_proxy = g_value_dup_object (value);
|
|
|
8c8af5 |
- g_signal_connect (client->priv->agent_proxy,
|
|
|
8c8af5 |
- "g-properties-changed",
|
|
|
8c8af5 |
- G_CALLBACK (on_agent_props_changed),
|
|
|
8c8af5 |
- object);
|
|
|
8c8af5 |
+ if (client->priv->agent_proxy != NULL)
|
|
|
8c8af5 |
+ g_signal_connect (client->priv->agent_proxy,
|
|
|
8c8af5 |
+ "g-properties-changed",
|
|
|
8c8af5 |
+ G_CALLBACK (on_agent_props_changed),
|
|
|
8c8af5 |
+ object);
|
|
|
8c8af5 |
break;
|
|
|
8c8af5 |
|
|
|
8c8af5 |
default:
|
|
|
8c8af5 |
--
|
|
|
8c8af5 |
2.1.0
|
|
|
8c8af5 |
|