[evolution-data-server/gnome-3-34] Correct runtime warning from camel_network_service_can_reach()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-34] Correct runtime warning from camel_network_service_can_reach()
- Date: Tue, 15 Oct 2019 09:49:23 +0000 (UTC)
commit a78ef3c3fe62780d28aec1308ea7d7b29d51ae9b
Author: Milan Crha <mcrha redhat com>
Date: Tue Oct 15 11:46:09 2019 +0200
Correct runtime warning from camel_network_service_can_reach()
A runtime warning about 'session' being NULL could be shown when the service
didn't have the session available anymore. This could happen for example
when checking authentication types, which uses its own temporary CamelSession.
Rather than claiming a runtime warning and not finishing the asynchronous
call at all handle this situation gracefully.
src/camel/camel-network-service.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/camel/camel-network-service.c b/src/camel/camel-network-service.c
index f5eff9040..383045021 100644
--- a/src/camel/camel-network-service.c
+++ b/src/camel/camel-network-service.c
@@ -1113,23 +1113,28 @@ camel_network_service_can_reach (CamelNetworkService *service,
gpointer user_data)
{
CamelSession *session;
- gchar *description;
GTask *task;
g_return_if_fail (CAMEL_IS_NETWORK_SERVICE (service));
session = camel_service_ref_session (CAMEL_SERVICE (service));
- g_return_if_fail (session != NULL);
task = g_task_new (service, cancellable, callback, user_data);
g_task_set_source_tag (task, camel_network_service_can_reach);
- description = g_strdup_printf (_("Checking reachability of account ā%sā"),
camel_service_get_display_name (CAMEL_SERVICE (service)));
+ if (session) {
+ gchar *description;
- camel_session_submit_job (session, description, network_service_can_reach_thread, task,
g_object_unref);
+ description = g_strdup_printf (_("Checking reachability of account ā%sā"),
camel_service_get_display_name (CAMEL_SERVICE (service)));
- g_object_unref (session);
- g_free (description);
+ camel_session_submit_job (session, description, network_service_can_reach_thread, task,
g_object_unref);
+
+ g_object_unref (session);
+ g_free (description);
+ } else {
+ g_task_return_boolean (task, FALSE);
+ g_object_unref (task);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]