diff options
author | Zeeshan Ali <zeeshanak@gnome.org> | 2019-11-26 17:35:06 +0100 |
---|---|---|
committer | Zeeshan Ali <zeeshanak@gnome.org> | 2019-11-26 17:41:07 +0100 |
commit | 0661107fe0f7918b13b866701621da2f849f6ea3 (patch) | |
tree | 64528e279caf262f690432577e13dd4955cdabe4 /src/gclue-location-source.c | |
parent | a1cbf6b4a0fcbfdc8d1983d64de12b162a1e0e07 (diff) | |
download | geoclue-0661107fe0f7918b13b866701621da2f849f6ea3.tar.gz |
LocationSource::start/stop should return TRUE if already in target state
If a source is already started/active and start() is called on it, it
shouuldn't return FALSE as that indicates a failure to start. The same
goes for stop() and inactive state.
In case of stop() being called on an already inactive source, the actual
source implementation will not do rest of the teardown and could end up in
a state where the object has been finalized while its resources are still
not freed. Not only does that constitute leaks but these resources include
timeouts that access the object that has already been freed.
It is my hope that this solves some of the crashes and leaks we still are
getting reports of.
Fixes #117 (hopefully!).
Diffstat (limited to 'src/gclue-location-source.c')
-rw-r--r-- | src/gclue-location-source.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gclue-location-source.c b/src/gclue-location-source.c index 79c78b7..f732dfe 100644 --- a/src/gclue-location-source.c +++ b/src/gclue-location-source.c @@ -290,7 +290,7 @@ start_source (GClueLocationSource *source) if (source->priv->active_counter > 1) { g_debug ("%s already active, not starting.", G_OBJECT_TYPE_NAME (source)); - return FALSE; + return TRUE; } if (source->priv->compute_movement) { @@ -313,7 +313,7 @@ stop_source (GClueLocationSource *source) if (source->priv->active_counter == 0) { g_debug ("%s already inactive, not stopping.", G_OBJECT_TYPE_NAME (source)); - return FALSE; + return TRUE; } source->priv->active_counter--; |