aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-01-31 21:29:05 -0600
committerTed Gould <ted@gould.cx>2011-01-31 21:29:05 -0600
commit10fb9c744b01451f037466c941f018257a674878 (patch)
treeb9b6bcf048cb81367f59d33e019861be60be87db
parentaaae5863299681153898d4e701f44aed85c780e9 (diff)
downloadayatana-indicator-datetime-10fb9c744b01451f037466c941f018257a674878.tar.gz
ayatana-indicator-datetime-10fb9c744b01451f037466c941f018257a674878.tar.bz2
ayatana-indicator-datetime-10fb9c744b01451f037466c941f018257a674878.zip
Make sure to clear the address when clients change.
-rw-r--r--src/datetime-service.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 8a31940..04a808a 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -393,6 +393,8 @@ geo_create_address (GeoclueMasterClient * master, GeoclueAddress * address, GErr
return;
}
+ g_warn_if_fail(geo_address == NULL);
+
g_debug("Created Geoclue Address");
geo_address = address;
g_object_ref(G_OBJECT(geo_address));
@@ -420,6 +422,13 @@ geo_client_invalid (GeoclueMasterClient * client, gpointer user_data)
{
g_warning("Master client invalid, rebuilding.");
+ /* Client changes we can assume the address is invalid */
+ if (geo_address != NULL) {
+ g_object_unref(G_OBJECT(geo_address));
+ }
+ geo_address = NULL;
+
+ /* And our master client is invalid */
if (geo_master != NULL) {
g_object_unref(G_OBJECT(geo_master));
}
@@ -470,6 +479,12 @@ geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar *
geo_master = client;
g_object_ref(G_OBJECT(geo_master));
+ /* New client, make sure we don't have an address hanging on */
+ if (geo_address != NULL) {
+ g_object_unref(G_OBJECT(geo_address));
+ }
+ geo_address = NULL;
+
geoclue_master_client_set_requirements_async(geo_master,
GEOCLUE_ACCURACY_LEVEL_REGION,
0,