/* Cancel the mail operation. We need to wrap it between this
start/stop operations to allow following calls to the
account */
- tny_account_cancel (priv->account);
+ if (priv->account)
+ tny_account_cancel (priv->account);
return canceled;
}
tny_header_set_flags (header, TNY_HEADER_FLAG_DELETED);
tny_header_set_flags (header, TNY_HEADER_FLAG_SEEN);
g_object_unref (header);
+ g_object_unref (folder);
}
}
update_account_thread (gpointer thr_user_data)
{
static gboolean first_time = TRUE;
- UpdateAccountInfo *info;
+ UpdateAccountInfo *info = NULL;
TnyList *all_folders = NULL;
GPtrArray *new_headers = NULL;
TnyIterator *iter = NULL;
TnyFolderStoreQuery *query = NULL;
ModestMailOperationPrivate *priv = NULL;
ModestTnySendQueue *send_queue = NULL;
- gint num_new_headers;
+ gint num_new_headers = 0;
info = (UpdateAccountInfo *) thr_user_data;
priv = MODEST_MAIL_OPERATION_GET_PRIVATE(info->mail_op);
trash_folder = modest_tny_account_get_special_folder (account,
TNY_FOLDER_TYPE_TRASH);
/* TODO: error_handling */
- modest_mail_operation_xfer_folder (self, folder,
+ if (trash_folder) {
+ modest_mail_operation_xfer_folder (self, folder,
TNY_FOLDER_STORE (trash_folder),
TRUE, NULL, NULL);
+ g_object_unref (trash_folder);
+ }
} else {
TnyFolderStore *parent = tny_folder_get_folder_store (folder);