const gchar *server_account_name;
gchar *url_string;
PwdAttempt *attempt = NULL;
+ gpointer attempt_ptr = NULL;
g_return_val_if_fail (account, NULL);
return NULL;
}
+ /* We need to do this to avoid "dereferencing type-punned pointer will break strict-aliasing rules" */
+ attempt_ptr = (gpointer) &attempt;
+
/* This hash map stores passwords, including passwords that are not stored in gconf. */
/* Is it in the hash? if it's already there, it must be wrong... */
already_asked = priv->password_hash && g_hash_table_lookup_extended (priv->password_hash,
server_account_name,
NULL,
- (gpointer*)&attempt);
+ attempt_ptr);
/* If the password is not already there, try ModestConf */
if (!already_asked) {
op_data->callback (op_data->account_store, op_data->userdata);
g_object_unref (op_data->account_store);
g_free (op_data);
- } else {
- g_object_unref (op_data->account_store);
}
}
g_return_if_fail (account && TNY_IS_ACCOUNT(account));
if (TNY_IS_STORE_ACCOUNT (account) &&
- !modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account)))
- goto frees;
-
- /* Disconnect account */
- if (tny_account_get_connection_status (account) == TNY_CONNECTION_STATUS_CONNECTED) {
- tny_camel_account_set_online (TNY_CAMEL_ACCOUNT(account), FALSE,
- account_shutdown_callback, op_data);
+ !modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account))) {
+ op_data->pending--;
return;
}
- frees:
- op_data->pending--;
- g_object_unref (op_data->account_store);
+ /* Disconnect account */
+ tny_camel_account_set_online (TNY_CAMEL_ACCOUNT(account), FALSE,
+ account_shutdown_callback, op_data);
+
}
ModestTnyAccountStoreShutdownCallback callback,
gpointer userdata)
{
- gint i, num_accounts;
+ gint num_accounts;
ShutdownOpData *op_data;
ModestTnyAccountStorePrivate *priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self);
if (priv->transport_accounts)
num_accounts += tny_list_get_length (priv->transport_accounts);
- for (i = 0 ; i < num_accounts ; i++)
- g_object_ref (self);
-
/* Create the helper object */
op_data = g_new0 (ShutdownOpData, 1);
op_data->callback = callback;
op_data->userdata = userdata;
op_data->pending = num_accounts;
- op_data->account_store = self;
+ op_data->account_store = g_object_ref (self);
+
+ /* Force the TnyDevice to be offline. This way new
+ undesired connections won't be initiated */
+ tny_device_force_offline (priv->device);
/* Destroy all accounts. Disconnect all accounts before they are destroyed */
if (priv->store_accounts) {
if (op_data->pending == 0) {
if (op_data->callback)
op_data->callback (op_data->account_store, op_data->userdata);
+ g_object_unref (op_data->account_store);
g_free (op_data);
}
}