← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/indicator-datetime/no-crash-geoclue into lp:indicator-datetime

 

Ted Gould has proposed merging lp:~ted/indicator-datetime/no-crash-geoclue into lp:indicator-datetime.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)

For more details, see:
https://code.launchpad.net/~ted/indicator-datetime/no-crash-geoclue/+merge/48105

Well, there's a case where it seems people's datetime will crash if they don't have ubuntu-geoip installed.  And I thought I could recreate it.  But, I've been unable though I reviewed the GeoClue code and here are some additional safe gaurds that could be added to hopefully stop the crash.
-- 
https://code.launchpad.net/~ted/indicator-datetime/no-crash-geoclue/+merge/48105
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'src/datetime-service.c'
--- src/datetime-service.c	2010-10-22 13:31:37 +0000
+++ src/datetime-service.c	2011-02-01 03:40:44 +0000
@@ -393,6 +393,8 @@
 		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 @@
 {
 	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_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,


Follow ups