From bf0bd3c7d05b5a7882c44257c66d580bce9935f4 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Fri, 13 Jul 2007 17:31:13 +0000 Subject: [PATCH] 2007-07-13 MMurray Cumming * src/modest-account-mgr.c: (modest_account_mgr_account_names): Ignore modest accounts whose server accounts don't exist in gconf. This prevents us trying to create TnyAccount instances for those server accounts when the server account has been removed from gconf, but the parent modest account has not yet been removed from modest. I don't know why this is only noticeable now. It was probably just a harmeless g_warning() anyway. pmo-trunk-r2736 --- ChangeLog2 | 10 ++++++++++ src/modest-account-mgr.c | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/ChangeLog2 b/ChangeLog2 index e13bce3..fb12d90 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,3 +1,13 @@ +2007-07-13 MMurray Cumming + + * src/modest-account-mgr.c: (modest_account_mgr_account_names): + Ignore modest accounts whose server accounts don't exist in gconf. + This prevents us trying to create TnyAccount instances for those + server accounts when the server account has been removed from gconf, + but the parent modest account has not yet been removed from modest. + I don't know why this is only noticeable now. It was probably just + a harmeless g_warning() anyway. + 2007-07-13 Murray Cumming * src/modest-ui-dimming-rules.c: (_selected_folder_is_root): diff --git a/src/modest-account-mgr.c b/src/modest-account-mgr.c index fc53d88..6a59bec 100644 --- a/src/modest-account-mgr.c +++ b/src/modest-account-mgr.c @@ -676,6 +676,31 @@ modest_account_mgr_account_names (ModestAccountMgr * self, gboolean only_enabled } } + /* Ignore modest accounts whose server accounts don't exist: + * (We could be getting this list while the account is being deleted, + * while the child server accounts have already been deleted, but the + * parent modest account already exists. + */ + if (add) { + gchar* server_account_name = modest_account_mgr_get_string (self, account_name_key, MODEST_ACCOUNT_STORE_ACCOUNT, + FALSE); + if (server_account_name) { + if (!modest_account_mgr_account_exists (self, server_account_name, TRUE)) + add = FALSE; + g_free (server_account_name); + } + } + + if (add) { + gchar* server_account_name = modest_account_mgr_get_string (self, account_name_key, MODEST_ACCOUNT_TRANSPORT_ACCOUNT, + FALSE); + if (server_account_name) { + if (!modest_account_mgr_account_exists (self, server_account_name, TRUE)) + add = FALSE; + g_free (server_account_name); + } + } + if (add) result = g_slist_append (result, unescaped_name); else -- 1.7.9.5