account_list = (account_type == TNY_ACCOUNT_TYPE_STORE ?
priv->store_accounts :
priv->transport_accounts);
-
+
iter = tny_list_create_iterator (account_list);
while (!tny_iterator_is_done (iter) && !found) {
TnyAccount *tny_account;
}
tny_iterator_next (iter);
}
-
- if (iter)
- g_object_unref (iter);
+ g_object_unref (iter);
}
static void
}
-void
+void
modest_tny_account_store_shutdown (ModestTnyAccountStore *self,
ModestTnyAccountStoreShutdownCallback callback,
gpointer userdata)
ModestTnyAccountStorePrivate *priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self);
/* Get references */
- num_accounts = tny_list_get_length (priv->store_accounts) +
- tny_list_get_length (priv->transport_accounts);
+ num_accounts = 0;
+ if (priv->store_accounts)
+ num_accounts += tny_list_get_length (priv->store_accounts);
+ if (priv->transport_accounts) {
+ num_accounts += tny_list_get_length (priv->transport_accounts);
+
for (i = 0 ; i < num_accounts ; i++)
g_object_ref (self);
if (priv->store_accounts) {
tny_list_foreach (priv->store_accounts, (GFunc)account_shutdown, op_data);
}
-
+
if (priv->transport_accounts) {
tny_list_foreach (priv->transport_accounts, (GFunc)account_shutdown, op_data);
}