[evolution-data-server] e_cal_backend_get_timezone_finish: Do not panic when the timezone cannot be found



commit 6b9b325373e4e5a4b74f171dbf0f08c0f2cff19c
Author: Milan Crha <mcrha redhat com>
Date:   Fri Mar 14 10:15:37 2014 +0100

    e_cal_backend_get_timezone_finish: Do not panic when the timezone cannot be found
    
    When the specific timezone could not be found, the function threw a runtime
    warning, and did not set an error, which further in the call made fail also
    data_cal_complete_get_timezone_cb(), which has a check for "either have
    a timezone object or an error", which finally prevented a correct finish
    of the D-Bus call, thus the client side which asked for an unknown timezone
    was left stuck, waiting for a response from the server which was not
    interested in the call anymore.
    
    This behaviour could lead to a UI freeze, as had been reported at:
    https://bugzilla.redhat.com/show_bug.cgi?id=1075461

 calendar/libedata-cal/e-cal-backend.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index ab53f72..ee43275 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -4007,7 +4007,7 @@ e_cal_backend_get_timezone_finish (ECalBackend *backend,
        g_return_val_if_fail (
                g_simple_async_result_is_valid (
                result, G_OBJECT (backend),
-               e_cal_backend_get_timezone), FALSE);
+               e_cal_backend_get_timezone), NULL);
 
        simple = G_SIMPLE_ASYNC_RESULT (result);
        async_context = g_simple_async_result_get_op_res_gpointer (simple);
@@ -4015,10 +4015,14 @@ e_cal_backend_get_timezone_finish (ECalBackend *backend,
        cal_backend_unblock_operations (backend, simple);
 
        if (g_simple_async_result_propagate_error (simple, error))
-               return FALSE;
+               return NULL;
 
        tzobject = g_queue_pop_head (&async_context->result_queue);
-       g_return_val_if_fail (tzobject != NULL, NULL);
+
+       if (!tzobject)
+               g_set_error_literal (error,
+                       E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND,
+                       e_client_error_to_string (E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND));
 
        g_warn_if_fail (g_queue_is_empty (&async_context->result_queue));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]