[evolution-data-server/gnome-3-8] ECalBackendWeather: e_weather_source_new() is failable.



commit 78a60087a52b056d9ef96428159cf02a5aa986af
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue May 7 13:51:37 2013 -0400

    ECalBackendWeather: e_weather_source_new() is failable.
    
    Backend logic was failing to take this into account and crashing if the
    weather location code in the ESource was invalid.
    
    I'm not sure if EWeatherSource is even worth keeping around, but I'll
    come back to that later.  Not doing an all-out rewrite at the moment.
    
    (cherry picked from commit ef17c11c438c390378130ae942d81d6feb65405d)

 calendar/backends/weather/e-cal-backend-weather.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/calendar/backends/weather/e-cal-backend-weather.c 
b/calendar/backends/weather/e-cal-backend-weather.c
index 1bc9535..61b96db 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -248,6 +248,13 @@ begin_retrieval_cb (ECalBackendWeather *cbw)
 
                location = e_source_weather_dup_location (extension);
                priv->source = e_weather_source_new (location);
+               if (priv->source == NULL) {
+                       g_warning (
+                               "Invalid weather location '%s' "
+                               "for calendar '%s'",
+                               location,
+                               e_source_get_display_name (e_source));
+               }
                g_free (location);
        }
 
@@ -256,14 +263,13 @@ begin_retrieval_cb (ECalBackendWeather *cbw)
        if (priv->begin_retrival_id == g_source_get_id (source))
                priv->begin_retrival_id = 0;
 
-       if (priv->is_loading)
-               return FALSE;
-
-       priv->is_loading = TRUE;
+       if (!priv->is_loading && priv->source != NULL) {
+               priv->is_loading = TRUE;
 
-       e_weather_source_parse (
-               priv->source, (EWeatherSourceFinished)
-               finished_retrieval_cb, cbw);
+               e_weather_source_parse (
+                       priv->source, (EWeatherSourceFinished)
+                       finished_retrieval_cb, cbw);
+       }
 
        return FALSE;
 }


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