Merge lp://qastaging/~charlesk/indicator-datetime/lp-1074999 into lp://qastaging/indicator-datetime/13.04

Proposed by Charles Kerr
Status: Merged
Approved by: Allan LeSage
Approved revision: 200
Merged at revision: 194
Proposed branch: lp://qastaging/~charlesk/indicator-datetime/lp-1074999
Merge into: lp://qastaging/indicator-datetime/13.04
Diff against target: 303 lines (+89/-87)
1 file modified
src/datetime-service.c (+89/-87)
To merge this branch: bzr merge lp://qastaging/~charlesk/indicator-datetime/lp-1074999
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Lars Karlitski (community) Approve
Review via email: mp+132829@code.qastaging.launchpad.net

Commit message

Don't use geoclue until the user clicks the "Show time in auto-detected location" checkbox.

Description of the change

Don't use geoclue until the user clicks the "Show time in auto-detected location" checkbox.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Lars Karlitski (larsu) wrote :

Nice cleanup!

`geo_master` doesn't need to be a global variable: it's only ever used in geo_start.

Why are you calling geo_stop unconditionally in on_use_geoclue_changed? I'd put it in the `else` below, in case the callback is called even though the value hasn't changed (which may happen according to the docs).

review: Needs Fixing
Revision history for this message
Charles Kerr (charlesk) wrote :

> `geo_master` doesn't need to be a global variable: it's only ever used in geo_start.

The issue is that geoclue_master_create_client_async() populates its private GeoclueMasterAsyncData struct with a pointer to that master without reffing it. That's why datetime-service keeps its own ref.

> Why are you calling geo_stop unconditionally in on_use_geoclue_changed? I'd put it in the `else` below, in case the callback is called even though the value hasn't changed (which may happen according to the docs).

It's to ensure that even if the callback triggered multiple calls to geo_start(), we would have a call to geo_stop() in between to guarantee that geo_master, geo_client, and geo_address were cleaned up.

Revision history for this message
Lars Karlitski (larsu) wrote :

> > `geo_master` doesn't need to be a global variable: it's only ever used in
> geo_start.
>
> The issue is that geoclue_master_create_client_async() populates its private
> GeoclueMasterAsyncData struct with a pointer to that master without reffing
> it. That's why datetime-service keeps its own ref.

That should be fixed in geoclue.

> > Why are you calling geo_stop unconditionally in on_use_geoclue_changed? I'd
> put it in the `else` below, in case the callback is called even though the
> value hasn't changed (which may happen according to the docs).
>
> It's to ensure that even if the callback triggered multiple calls to
> geo_start(), we would have a call to geo_stop() in between to guarantee that
> geo_master, geo_client, and geo_address were cleaned up.

Sounds reasonable.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Allan LeSage (allanlesage) wrote :

Misconfiguration foiled autolanding; re-approving to send through again.

Revision history for this message
Charles Kerr (charlesk) wrote :

Thanks Allan!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches