From c04ab071899d306e23eda403d125fa8e5867e2e9 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 5 Feb 2014 12:40:34 +0000 Subject: [PATCH 4/7] McdAccountManager: if an account is async-added during setup, wait for it Previously, we'd only wait for accounts added in mcd_storage_load() to become ready. --- src/mcd-account-manager.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c index 593e698..489de45 100644 --- a/src/mcd-account-manager.c +++ b/src/mcd-account-manager.c @@ -100,6 +100,7 @@ typedef struct McpAccountStorage *storage_plugin; McdAccount *account; gint account_lock; + gboolean holds_setup_lock; } McdLoadAccountsData; typedef struct @@ -296,6 +297,12 @@ created_cb (GObject *storage_plugin_obj, lad->storage_plugin = g_object_ref (plugin); lad->account_lock = 1; /* released at the end of this function */ lad->account = g_object_ref (account); + + if (self->priv->setup_lock > 0) + { + lad->holds_setup_lock = TRUE; + self->priv->setup_lock++; + } } else { @@ -1132,6 +1139,9 @@ release_load_accounts_lock (McdLoadAccountsData *lad) if (lad->account_lock == 0) { + if (lad->holds_setup_lock) + release_setup_lock (lad->account_manager); + g_object_unref (lad->account_manager); g_object_unref (lad->storage_plugin); g_object_unref (lad->account); -- 1.9.rc1