GSList *cursor = accounts;
while (cursor) {
+ /* TODO: This uses cursor->data after causing it to be freed,
+ * as valgrind shows.
+ * It's not clear what is being attempted here. murrayc */
g_object_unref (G_OBJECT(cursor->data));
if (G_IS_OBJECT(cursor->data)) { /* check twice... */
const gchar *id = tny_account_get_id(TNY_ACCOUNT(cursor->data));
/* FIXME: make this more finegrained; changes do not really affect _all_
* accounts, and some do not affect tny accounts at all (such as 'last_update')
*/
- account_list_free (priv->store_accounts);
- priv->store_accounts = NULL;
+ if (priv->store_accounts) {
+ account_list_free (priv->store_accounts);
+ priv->store_accounts = NULL;
+ }
- account_list_free (priv->transport_accounts);
- priv->transport_accounts = NULL;
+ if (priv->transport_accounts) {
+ account_list_free (priv->transport_accounts);
+ priv->transport_accounts = NULL;
+ }
g_signal_emit (G_OBJECT(self), signals[ACCOUNT_UPDATE_SIGNAL], 0,
account);
ModestTnyAccountStore *self = MODEST_TNY_ACCOUNT_STORE(obj);
ModestTnyAccountStorePrivate *priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
- gboolean debug = modest_runtime_get_debug_flags() & MODEST_RUNTIME_DEBUG_DEBUG_OBJECTS;
+ //gboolean debug = modest_runtime_get_debug_flags() & MODEST_RUNTIME_DEBUG_DEBUG_OBJECTS;
g_free (priv->cache_dir);
priv->cache_dir = NULL;
if (priv->session) {
camel_object_unref (CAMEL_OBJECT(priv->session));
- if (debug && CAMEL_IS_OBJECT(priv->session))
- g_warning ("%s:%d: TnyCamelSession still holds a refcount of %d",
- __FILE__,__LINE__,CAMEL_OBJECT(priv->session)->ref_count);
+ modest_runtime_verify_object_death(priv->session, "");
priv->session = NULL;
}
obj = G_OBJECT(g_object_new(MODEST_TYPE_TNY_ACCOUNT_STORE, NULL));
priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(obj);
- priv->account_mgr = account_mgr;
- g_object_ref (G_OBJECT(priv->account_mgr));
-
- priv->device = device;
- g_object_ref (priv->device);
+ priv->account_mgr = g_object_ref (G_OBJECT(account_mgr));
+ priv->device = g_object_ref (device);
priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE(obj));
type, priv->session,
get_password,
forget_password);
- if (tny_account) { /* something went wrong */
+ if (tny_account) {
g_object_set_data (G_OBJECT(tny_account), "account_store",
(gpointer)self);
tny_list_prepend (list, G_OBJECT(tny_account));
TnySessionCamel*
tny_account_store_get_session (TnyAccountStore *self)
{
- g_return_val_if_fail (self, NULL);
+ g_return_val_if_fail (self, NULL);
return MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self)->session;
}
for (cursor = priv->store_accounts; cursor ; cursor = cursor->next) {
const gchar *acc_id = tny_account_get_id (TNY_ACCOUNT(cursor->data));
- if (acc_id && strcmp (acc_id, id) == 0) {
- account = TNY_ACCOUNT(cursor->data);
+ if (acc_id && strcmp (acc_id, id) == 0) {
+ account = TNY_ACCOUNT(cursor->data);
break;
}
}
else if (account_data->transport_account)
id = account_data->transport_account->account_name;
- if (id)
+ if (!id)
+ g_printerr ("modest: could not get an id for account %s\n",
+ account_name);
+ else
account = modest_tny_account_store_get_tny_account_by_id (self, id);
+
if (!account)
g_printerr ("modest: could not get tny %s account for %s (id=%s)\n",
type == TNY_ACCOUNT_TYPE_STORE? "store" : "transport",