repo: Initialize GPGME in instance init()

Initially I had this in class_init() but there it would get invoked
during introspection scanning.
This commit is contained in:
Matthew Barnes 2015-04-30 11:06:24 -04:00
parent 97379ec38c
commit ca63fab6b1

View File

@ -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);