diff options
author | Milan Crha <mcrha@redhat.com> | 2015-10-27 08:56:54 +0100 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2015-10-27 08:58:18 +0100 |
commit | 68137ddfd8909bcf7add11da0b03c03e191b7c42 (patch) | |
tree | 2eb65953147b65ac167143bea78dcd7aa31e768d | |
parent | c6ecd77cdcbb1e5d201925f684ec72115210a445 (diff) | |
download | evolution-data-server-68137ddfd8909bcf7add11da0b03c03e191b7c42.tar.gz |
Bug 757169 - Crash on GTasks save from gnome-todo
-rw-r--r-- | 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 912d1225a..99f3e02df 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); |