Blame SOURCES/service-client-Delay-unrefing-ServiceLocation.patch

8c8af5
From 775211c190a01269aa731922f31b54b0451c7ce1 Mon Sep 17 00:00:00 2001
8c8af5
From: "Zeeshan Ali (Khattak)" <zeeshanak@gnome.org>
8c8af5
Date: Wed, 1 Apr 2015 18:24:32 +0100
8c8af5
Subject: [PATCH 5/7] service-client: Delay unrefing ServiceLocation
8c8af5
8c8af5
Lets try to ensure that apps are not still accessing the last location
8c8af5
before unrefing (and therefore destroying) it by delaying the unref
8c8af5
operation by 5 seconds after a ServiceLocation object becomes obsolete.
8c8af5
8c8af5
https://bugs.freedesktop.org/show_bug.cgi?id=89782
8c8af5
---
8c8af5
 src/gclue-service-client.c | 13 ++++++++++++-
8c8af5
 1 file changed, 12 insertions(+), 1 deletion(-)
8c8af5
8c8af5
diff --git a/src/gclue-service-client.c b/src/gclue-service-client.c
8c8af5
index 0ff3e85..ae22601 100644
8c8af5
--- a/src/gclue-service-client.c
8c8af5
+++ b/src/gclue-service-client.c
8c8af5
@@ -138,6 +138,14 @@ below_threshold (GClueServiceClient *client,
8c8af5
         return FALSE;
8c8af5
 }
8c8af5
 
8c8af5
+static gboolean
8c8af5
+on_prev_location_timeout (gpointer user_data)
8c8af5
+{
8c8af5
+        g_object_unref (user_data);
8c8af5
+
8c8af5
+        return FALSE;
8c8af5
+}
8c8af5
+
8c8af5
 static void
8c8af5
 on_locator_location_changed (GObject    *gobject,
8c8af5
                              GParamSpec *pspec,
8c8af5
@@ -163,7 +171,10 @@ on_locator_location_changed (GObject    *gobject,
8c8af5
                 return;
8c8af5
         }
8c8af5
 
8c8af5
-        g_clear_object (&priv->prev_location);
8c8af5
+        if (priv->prev_location != NULL)
8c8af5
+                // Lets try to ensure that apps are not still accessing the
8c8af5
+                // last location before unrefing (and therefore destroying) it.
8c8af5
+                g_timeout_add_seconds (5, on_prev_location_timeout, priv->prev_location);
8c8af5
         priv->prev_location = priv->location;
8c8af5
 
8c8af5
         path = next_location_path (client);
8c8af5
-- 
8c8af5
2.1.0
8c8af5