[evolution-data-server] [EDataCalView] Ensure GDBus string for view signals



commit 8d3eb19de49517be21019bce2ac0a858caf615b6
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 11 13:01:08 2016 +0100

    [EDataCalView] Ensure GDBus string for view signals
    
    Make sure the string passed to GDBus calls (and signals) is valid
    UTF-8 string, otherwise GVariant claims runtime warning and other
    things get broken.

 calendar/libedata-cal/e-data-cal-view.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/calendar/libedata-cal/e-data-cal-view.c b/calendar/libedata-cal/e-data-cal-view.c
index b0e4513..442a9d8 100644
--- a/calendar/libedata-cal/e-data-cal-view.c
+++ b/calendar/libedata-cal/e-data-cal-view.c
@@ -1141,6 +1141,8 @@ gchar *
 e_data_cal_view_get_component_string (EDataCalView *view,
                                       ECalComponent *component)
 {
+       gchar *str = NULL, *res = NULL;
+
        g_return_val_if_fail (E_IS_DATA_CAL_VIEW (view), NULL);
        g_return_val_if_fail (E_IS_CAL_COMPONENT (component), NULL);
 
@@ -1149,12 +1151,20 @@ e_data_cal_view_get_component_string (EDataCalView *view,
                icalcomponent *icalcomp = e_cal_component_get_icalcomponent (component);
 
                if (filter_component (icalcomp, view->priv->fields_of_interest, string))
-                       return g_string_free (string, FALSE);
-
-               g_string_free (string, TRUE);
+                       str = g_string_free (string, FALSE);
+               else
+                       g_string_free (string, TRUE);
        }
 
-       return e_cal_component_get_as_string (component);
+       if (!str)
+               str = e_cal_component_get_as_string (component);
+
+       if (e_util_ensure_gdbus_string (str, &res) == str)
+               res = str;
+       else
+               g_free (str);
+
+       return res;
 }
 
 /**


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