[evolution-data-server/gnome-3-18] Bug 757169 - Crash on GTasks save from gnome-todo



commit 68137ddfd8909bcf7add11da0b03c03e191b7c42
Author: Milan Crha <mcrha redhat com>
Date:   Tue Oct 27 08:56:54 2015 +0100

    Bug 757169 - Crash on GTasks save from gnome-todo

 calendar/backends/gtasks/e-cal-backend-gtasks.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/calendar/backends/gtasks/e-cal-backend-gtasks.c b/calendar/backends/gtasks/e-cal-backend-gtasks.c
index 912d122..99f3e02 100644
--- a/calendar/backends/gtasks/e-cal-backend-gtasks.c
+++ b/calendar/backends/gtasks/e-cal-backend-gtasks.c
@@ -322,7 +322,8 @@ ecb_gtasks_gdata_to_comp (GDataTasksTask *task)
 }
 
 static GDataTasksTask *
-ecb_gtasks_comp_to_gdata (ECalComponent *comp)
+ecb_gtasks_comp_to_gdata (ECalComponent *comp,
+                         ECalComponent *cached_comp)
 {
        GDataEntry *entry;
        GDataTasksTask *task;
@@ -377,6 +378,19 @@ ecb_gtasks_comp_to_gdata (ECalComponent *comp)
                gdata_tasks_task_set_status (task, "needsAction");
 
        tmp = ecb_gtasks_icomp_x_prop_get (icomp, X_EVO_GTASKS_SELF_LINK);
+       if (!tmp || !*tmp) {
+               g_free (tmp);
+               tmp = NULL;
+
+               /* If the passed-in component doesn't contain the libgdata self link,
+                  then get it from the cached comp */
+               if (cached_comp) {
+                       tmp = ecb_gtasks_icomp_x_prop_get (
+                               e_cal_component_get_icalcomponent (cached_comp),
+                               X_EVO_GTASKS_SELF_LINK);
+               }
+       }
+
        if (tmp && *tmp) {
                GDataLink *data_link;
 
@@ -975,7 +989,7 @@ ecb_gtasks_create_objects (ECalBackend *backend,
                        icalcomponent_set_uid (icomp, "");
                }
 
-               comp_task = ecb_gtasks_comp_to_gdata (comp);
+               comp_task = ecb_gtasks_comp_to_gdata (comp, NULL);
                if (!comp_task) {
                        g_object_unref (comp);
                        local_error = EDC_ERROR (InvalidObject);
@@ -1094,7 +1108,7 @@ ecb_gtasks_modify_objects (ECalBackend *backend,
                        break;
                }
 
-               comp_task = ecb_gtasks_comp_to_gdata (comp);
+               comp_task = ecb_gtasks_comp_to_gdata (comp, cached_comp);
                g_object_unref (comp);
 
                if (!comp_task) {
@@ -1180,7 +1194,7 @@ ecb_gtasks_remove_objects (ECalBackend *backend,
                        break;
                }
 
-               task = ecb_gtasks_comp_to_gdata (cached_comp);
+               task = ecb_gtasks_comp_to_gdata (cached_comp, NULL);
                if (!task) {
                        g_object_unref (cached_comp);
                        local_error = EDC_ERROR (InvalidObject);


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