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

Proposed by Ted Gould
Status: Merged
Merged at revision: 37
Proposed branch: lp:~ted/indicator-datetime/no-crash-geoclue
Merge into: lp:indicator-datetime/0.3
Diff against target: 39 lines (+15/-0)
1 file modified
src/datetime-service.c (+15/-0)
To merge this branch: bzr merge lp:~ted/indicator-datetime/no-crash-geoclue
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+48105@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

It's unclear to me exactly what situation these checks guard against. Can you add a code comment explaining the situation before you merge this?

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/datetime-service.c'
2--- src/datetime-service.c 2010-10-22 13:31:37 +0000
3+++ src/datetime-service.c 2011-02-01 03:40:44 +0000
4@@ -393,6 +393,8 @@
5 return;
6 }
7
8+ g_warn_if_fail(geo_address == NULL);
9+
10 g_debug("Created Geoclue Address");
11 geo_address = address;
12 g_object_ref(G_OBJECT(geo_address));
13@@ -420,6 +422,13 @@
14 {
15 g_warning("Master client invalid, rebuilding.");
16
17+ /* Client changes we can assume the address is invalid */
18+ if (geo_address != NULL) {
19+ g_object_unref(G_OBJECT(geo_address));
20+ }
21+ geo_address = NULL;
22+
23+ /* And our master client is invalid */
24 if (geo_master != NULL) {
25 g_object_unref(G_OBJECT(geo_master));
26 }
27@@ -470,6 +479,12 @@
28 geo_master = client;
29 g_object_ref(G_OBJECT(geo_master));
30
31+ /* New client, make sure we don't have an address hanging on */
32+ if (geo_address != NULL) {
33+ g_object_unref(G_OBJECT(geo_address));
34+ }
35+ geo_address = NULL;
36+
37 geoclue_master_client_set_requirements_async(geo_master,
38 GEOCLUE_ACCURACY_LEVEL_REGION,
39 0,

Subscribers

People subscribed via source and target branches

to all changes: