[libsecret/wip/dueno/backend: 12/15] secret-backend: Add a way to uncache singleton instance
- From: Daiki Ueno <dueno src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsecret/wip/dueno/backend: 12/15] secret-backend: Add a way to uncache singleton instance
- Date: Tue, 8 Oct 2019 07:56:28 +0000 (UTC)
commit b37d2b8d201e9c6095ead8310fa5b416b75682db
Author: Daiki Ueno <dueno src gnome org>
Date: Mon Jul 1 17:29:10 2019 +0200
secret-backend: Add a way to uncache singleton instance
This is ugly, but necessary to handle instance uncaching in
SecretBackend when the backend instance is gone.
libsecret/secret-backend.c | 14 ++++++++++++++
libsecret/secret-backend.h | 2 ++
libsecret/secret-service.c | 2 ++
3 files changed, 18 insertions(+)
---
diff --git a/libsecret/secret-backend.c b/libsecret/secret-backend.c
index 2c26c7d..a63b75c 100644
--- a/libsecret/secret-backend.c
+++ b/libsecret/secret-backend.c
@@ -122,6 +122,20 @@ backend_get_instance (void)
return instance;
}
+void
+_secret_backend_uncache_instance (void)
+{
+ SecretBackend *instance = NULL;
+
+ G_LOCK (backend_instance);
+ instance = backend_instance;
+ backend_instance = NULL;
+ G_UNLOCK (backend_instance);
+
+ if (instance != NULL)
+ g_object_unref (instance);
+}
+
static GType
backend_get_impl_type (void)
{
diff --git a/libsecret/secret-backend.h b/libsecret/secret-backend.h
index 7dae506..3dadffa 100644
--- a/libsecret/secret-backend.h
+++ b/libsecret/secret-backend.h
@@ -97,6 +97,8 @@ struct _SecretBackendInterface
void _secret_backend_ensure_extension_point
(void);
+void _secret_backend_uncache_instance
+ (void);
void secret_backend_get (SecretBackendFlags flags,
GCancellable *cancellable,
diff --git a/libsecret/secret-service.c b/libsecret/secret-service.c
index 95498a6..36d2feb 100644
--- a/libsecret/secret-service.c
+++ b/libsecret/secret-service.c
@@ -191,6 +191,8 @@ service_uncache_instance (SecretService *which)
if (watch != 0)
g_bus_unwatch_name (watch);
+ _secret_backend_uncache_instance ();
+
return matched;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]