* Fixed a warning+critical when finalizing
authorSergio Villar Senin <svillar@igalia.com>
Wed, 9 Apr 2008 11:40:32 +0000 (11:40 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Wed, 9 Apr 2008 11:40:32 +0000 (11:40 +0000)
* Do not call tny_account_set_id twice when creating accounts

pmo-trunk-r4387

src/modest-tny-account-store.c
src/modest-tny-account.c

index 99cbaf7..2f5ebbe 100644 (file)
@@ -301,8 +301,11 @@ account_disconnect (TnyAccount *account)
 {
        g_return_if_fail (account && TNY_IS_ACCOUNT(account));
 
-       if (modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account)))
-               tny_camel_account_set_online (TNY_CAMEL_ACCOUNT(account), FALSE, NULL, NULL);
+       if (TNY_IS_STORE_ACCOUNT (account) && 
+           !modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account)))
+               return;
+
+       tny_camel_account_set_online (TNY_CAMEL_ACCOUNT(account), FALSE, NULL, NULL);
 }
 
 
index 2496a16..7e620ec 100644 (file)
@@ -274,7 +274,10 @@ update_tny_account (TnyAccount *tny_account,
        g_return_val_if_fail (account_name, FALSE);
        g_return_val_if_fail (tny_account, FALSE);
        
-       tny_account_set_id (tny_account, account_name);
+       /* Do not change the id if it's not needed */
+       if (tny_account_get_id (tny_account) && 
+           strcmp (tny_account_get_id (tny_account), account_name))
+               tny_account_set_id (tny_account, account_name);
        
        /* mbox and maildir accounts use a URI instead of the rest:
         * Note that this is not where we create the special local folders account.