From: Dirk-Jan C. Binnema Date: Mon, 2 Jul 2007 10:50:19 +0000 (+0000) Subject: * add checks that session != NULL X-Git-Tag: git_migration_finished~3012 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=43e62768748b9385ba4ba926c14c59ed2eaa3f9f * add checks that session != NULL pmo-trunk-r2525 --- diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index fd792c5..9d46e75 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -600,17 +600,14 @@ modest_tny_account_store_new (ModestAccountMgr *account_mgr, TnyDevice *device) priv->device = g_object_ref (device); priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE(obj)); + if (!priv->session) { + g_warning ("failed to get TnySessionCamel"); + return NULL; + } tny_session_camel_set_ui_locker (priv->session, tny_gtk_lockable_new ()); - /* FIXME: unref this in the end? */ tny_session_camel_set_async_connecting (priv->session, TRUE); - - /* force a cache fill... ugly */ - /* list = TNY_LIST(tny_simple_list_new()); */ -/* tny_account_store_get_accounts (TNY_ACCOUNT_STORE(obj), list, */ -/* TNY_ACCOUNT_STORE_BOTH); */ -/* g_object_unref(list); */ - + /* Connect signals */ g_signal_connect (G_OBJECT(account_mgr), "account_changed", G_CALLBACK (on_account_changed), obj); diff --git a/src/modest-tny-account.c b/src/modest-tny-account.c index 96edb80..8b2f70d 100644 --- a/src/modest-tny-account.c +++ b/src/modest-tny-account.c @@ -411,6 +411,7 @@ modest_tny_account_new_from_account (ModestAccountMgr *account_mgr, const gchar g_return_val_if_fail (account_mgr, NULL); g_return_val_if_fail (account_name, NULL); + g_return_val_if_fail (session, NULL); account_data = modest_account_mgr_get_account_data (account_mgr, account_name); if (!account_data) { @@ -564,8 +565,11 @@ void modest_tny_account_get_mmc_account_name (TnyStoreAccount* self, ModestTnyAc TnyAccount* -modest_tny_account_new_for_local_folders (ModestAccountMgr *account_mgr, TnySessionCamel *session, const gchar* location_filepath) +modest_tny_account_new_for_local_folders (ModestAccountMgr *account_mgr, TnySessionCamel *session, + const gchar* location_filepath) { + + /* Make sure that the directories exist: */ modest_init_local_folders (location_filepath); @@ -574,6 +578,8 @@ modest_tny_account_new_for_local_folders (ModestAccountMgr *account_mgr, TnySess gchar *maildir, *url_string; g_return_val_if_fail (account_mgr, NULL); + g_return_val_if_fail (session, NULL); + if (!location_filepath) { /* A NULL filepath means that this is the special local-folders maildir @@ -659,10 +665,13 @@ modest_tny_account_new_for_local_folders (ModestAccountMgr *account_mgr, TnySess TnyAccount* -modest_tny_account_new_for_per_account_local_outbox_folder (ModestAccountMgr *account_mgr, const gchar* account_name, TnySessionCamel *session) +modest_tny_account_new_for_per_account_local_outbox_folder (ModestAccountMgr *account_mgr, + const gchar* account_name, + TnySessionCamel *session) { g_return_val_if_fail (account_mgr, NULL); g_return_val_if_fail (account_name, NULL); + g_return_val_if_fail (session, NULL); /* Notice that we create a ModestTnyOutboxAccount here, * instead of just a TnyCamelStoreAccount,