diff options
author | Ted Gould <ted@gould.cx> | 2011-01-31 21:29:05 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-01-31 21:29:05 -0600 |
commit | 10fb9c744b01451f037466c941f018257a674878 (patch) | |
tree | b9b6bcf048cb81367f59d33e019861be60be87db /src/datetime-service.c | |
parent | aaae5863299681153898d4e701f44aed85c780e9 (diff) | |
download | ayatana-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.
Diffstat (limited to 'src/datetime-service.c')
-rw-r--r-- | src/datetime-service.c | 15 |
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, |