[ostree] repo: Initialize GPGME in instance init()
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] repo: Initialize GPGME in instance init()
- Date: Fri, 1 May 2015 18:43:11 +0000 (UTC)
commit ca63fab6b1642f1c13a44681bee0684fd64238ac
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Apr 30 11:06:24 2015 -0400
repo: Initialize GPGME in instance init()
Initially I had this in class_init() but there it would get invoked
during introspection scanning.
src/libostree/ostree-repo.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 262d0e9..5bdba3c 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -507,6 +507,15 @@ ostree_repo_class_init (OstreeRepoClass *klass)
static void
ostree_repo_init (OstreeRepo *self)
{
+ static gsize gpgme_initialized;
+
+ if (g_once_init_enter (&gpgme_initialized))
+ {
+ gpgme_check_version (NULL);
+ gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
+ g_once_init_leave (&gpgme_initialized, 1);
+ }
+
g_mutex_init (&self->cache_lock);
g_mutex_init (&self->txn_stats_lock);
@@ -3056,9 +3065,6 @@ sign_data (OstreeRepo *self,
cancellable, error))
goto out;
- gpgme_check_version (NULL);
- gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
-
if ((err = gpgme_new (&context)) != GPG_ERR_NO_ERROR)
{
ot_gpgme_error_to_gio_error (err, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]