Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:jberkman
evolution-exchange-2.6
bnc-166990-ex-crash-load-cal.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bnc-166990-ex-crash-load-cal.diff of Package evolution-exchange-2.6
Index: calendar/e-cal-backend-exchange.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange.c,v retrieving revision 1.66 diff -u -p -r1.66 e-cal-backend-exchange.c --- calendar/e-cal-backend-exchange.c 24 Apr 2006 08:23:36 -0000 1.66 +++ calendar/e-cal-backend-exchange.c 27 Apr 2006 11:33:22 -0000 @@ -59,6 +59,7 @@ struct ECalBackendExchangePrivate { guint save_timeout_id; GMutex *set_lock; GMutex *open_lock; + GMutex *cache_lock; /* Timezones */ GHashTable *timezones; @@ -529,6 +530,7 @@ e_cal_backend_exchange_cache_sync_end (E g_return_if_fail (cbex->priv->cache_unseen != NULL); g_hash_table_foreach (cbex->priv->cache_unseen, uncache, cbex); + g_hash_table_destroy (cbex->priv->cache_unseen); cbex->priv->cache_unseen = NULL; @@ -730,6 +732,18 @@ modify_object (ECalBackendSync *backend, return GNOME_Evolution_Calendar_OtherError; } +void +e_cal_backend_exchange_cache_lock (ECalBackendExchange *cbex) +{ + g_mutex_lock (cbex->priv->cache_lock); +} + +void +e_cal_backend_exchange_cache_unlock (ECalBackendExchange *cbex) +{ + g_mutex_unlock (cbex->priv->cache_lock); +} + ECalBackendExchangeComponent * get_exchange_comp (ECalBackendExchange *cbex, const char *uid) { @@ -767,12 +781,18 @@ get_object (ECalBackendSync *backend, ED /*any other asserts?*/ *object = NULL; + + g_mutex_lock (cbex->priv->cache_lock); ecomp = g_hash_table_lookup (cbex->priv->objects, uid); - if (!ecomp) + if (!ecomp) { + g_mutex_unlock (cbex->priv->cache_lock); return GNOME_Evolution_Calendar_ObjectNotFound; + } - if (!rid && (!(ecomp->icomp))) + if (!rid && (!(ecomp->icomp))) { + g_mutex_unlock (cbex->priv->cache_lock); return GNOME_Evolution_Calendar_ObjectNotFound; + } if (rid && *rid) { GList *l; @@ -798,13 +818,16 @@ get_object (ECalBackendSync *backend, ED itt = icaltime_from_string (rid); new_inst = e_cal_util_construct_instance (ecomp->icomp, itt); - if (!new_inst) + if (!new_inst) { + g_mutex_unlock (cbex->priv->cache_lock); return GNOME_Evolution_Calendar_ObjectNotFound; + } *object = g_strdup (icalcomponent_as_ical_string (new_inst)); icalcomponent_free (new_inst); } else { /* Oops. No instance and no master as well !! */ + g_mutex_unlock (cbex->priv->cache_lock); return GNOME_Evolution_Calendar_ObjectNotFound; } /* Close check for master object */ } /* Close check for instance */ @@ -830,6 +853,7 @@ get_object (ECalBackendSync *backend, ED *object = g_strdup (icalcomponent_as_ical_string (ecomp->icomp)); } } + g_mutex_unlock (cbex->priv->cache_lock); return GNOME_Evolution_Calendar_Success; } @@ -999,9 +1023,11 @@ get_object_list (ECalBackendSync *backen { ECalBackendExchange *cbex; + ECalBackendExchangePrivate *priv; MatchObjectData match_data; cbex = E_CAL_BACKEND_EXCHANGE (backend); + priv = cbex->priv; match_data.search_needed = TRUE; match_data.query = sexp; @@ -1015,11 +1041,15 @@ get_object_list (ECalBackendSync *backen match_data.obj_sexp = e_cal_backend_sexp_new (sexp); if (!match_data.obj_sexp) return GNOME_Evolution_Calendar_InvalidQuery; - + + g_mutex_lock (priv->cache_lock); g_hash_table_foreach (cbex->priv->objects, (GHFunc) match_object_sexp, &match_data); + g_mutex_unlock (priv->cache_lock); *objects = match_data.obj_list; + g_object_unref (match_data.obj_sexp); + return GNOME_Evolution_Calendar_Success; } @@ -1135,74 +1165,32 @@ set_default_timezone (ECalBackendSync *b return GNOME_Evolution_Calendar_Success; } -struct search_data { - ECalBackendSExp *sexp; - GList *matches; - ECalBackend *backend; -}; - -static void -match_object (gpointer key, gpointer value, gpointer data) -{ - ECalBackendExchangeComponent *ecomp = value; - struct search_data *sd = data; - ECalComponent *cal_comp; - icalcomponent *tmp = NULL; - char * ecal_str; - GList *inst; - - /* FIXME: we shouldn't have to convert to ECalComponent here */ - cal_comp = e_cal_component_new (); - - /* Find a way to test if the icalcomp added to cal_comp is not null */ - /* ecomp->icomp would not exist for a detached instance with no master object */ - if (ecomp->icomp) { - tmp = icalcomponent_new_clone (ecomp->icomp); - e_cal_component_set_icalcomponent (cal_comp, tmp); - if (e_cal_backend_sexp_match_comp (sd->sexp, cal_comp, sd->backend)) { - ecal_str = e_cal_component_get_as_string (cal_comp); - if (ecal_str) - sd->matches = g_list_prepend (sd->matches, ecal_str); - } - } - - for (inst = ecomp->instances; inst; inst = inst->next) { - e_cal_component_set_icalcomponent (cal_comp, icalcomponent_new_clone (inst->data)); - if (e_cal_backend_sexp_match_comp (sd->sexp, cal_comp, sd->backend)) { - ecal_str = e_cal_component_get_as_string (cal_comp); - if (ecal_str) - sd->matches = g_list_prepend (sd->matches, ecal_str); - } - } - - g_object_unref (cal_comp); -} - static void start_query (ECalBackend *backend, EDataCalView *view) { - ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend); - struct search_data sd; - GList *m; + char *sexp = NULL; + ECalBackendSyncStatus status = GNOME_Evolution_Calendar_OtherError; + GList *m, *objects = NULL; d(printf("ecbe_start_query(%p, %p)\n", backend, view)); - sd.sexp = e_data_cal_view_get_object_sexp (view); - if (!sd.sexp) { + sexp = e_data_cal_view_get_text (view); + if (!sexp) { e_data_cal_view_notify_done (view, GNOME_Evolution_Calendar_InvalidQuery); return; } - sd.matches = NULL; - sd.backend = backend; - - g_hash_table_foreach (cbex->priv->objects, match_object, &sd); + status = get_object_list (E_CAL_BACKEND_SYNC (backend), NULL, sexp, &objects); + if (status != GNOME_Evolution_Calendar_Success) { + e_data_cal_view_notify_done (view, status); + return; + } - if (sd.matches) { - e_data_cal_view_notify_objects_added (view, sd.matches); + if (objects) { + e_data_cal_view_notify_objects_added (view, objects); - for (m = sd.matches; m; m = m->next) + for (m = objects; m; m = m->next) g_free (m->data); - g_list_free (sd.matches); + g_list_free (objects); } e_data_cal_view_notify_done (view, GNOME_Evolution_Calendar_Success); @@ -1849,6 +1837,7 @@ init (ECalBackendExchange *cbex) cbex->priv->set_lock = g_mutex_new (); cbex->priv->open_lock = g_mutex_new (); + cbex->priv->cache_lock = g_mutex_new (); cbex->priv->cache_unseen = NULL; e_cal_backend_sync_set_lock (E_CAL_BACKEND_SYNC (cbex), TRUE); @@ -1889,6 +1878,10 @@ finalize (GObject *object) cbex->priv->open_lock = NULL; } + if (cbex->priv->cache_lock) { + g_mutex_free (cbex->priv->cache_lock); + cbex->priv->cache_lock = NULL; + } g_free (cbex->priv); if (G_OBJECT_CLASS (parent_class)->finalize) Index: calendar/e-cal-backend-exchange-calendar.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange-calendar.c,v retrieving revision 1.58 diff -u -p -r1.58 e-cal-backend-exchange-calendar.c --- calendar/e-cal-backend-exchange-calendar.c 21 Apr 2006 09:06:36 -0000 1.58 +++ calendar/e-cal-backend-exchange-calendar.c 27 Apr 2006 11:33:22 -0000 @@ -174,8 +174,10 @@ add_vevent (ECalBackendExchange *cbex, icalproperty_free (prop); } + e_cal_backend_exchange_cache_lock (cbex); /* Now add to the cache */ status = e_cal_backend_exchange_add_object (cbex, href, lastmod, icalcomp); + e_cal_backend_exchange_cache_unlock (cbex); return status; } @@ -343,6 +345,7 @@ get_changed_events (ECalBackendExchange cbex->private_item_restriction, NULL); } + e_cal_backend_exchange_cache_lock (cbex); if (since) { rn = e2k_restriction_andv ( rn, @@ -351,6 +354,7 @@ get_changed_events (ECalBackendExchange NULL); } else e_cal_backend_exchange_cache_sync_start (cbex); + e_cal_backend_exchange_cache_unlock (cbex); iter = e_folder_exchange_search_start (cbex->folder, NULL, event_properties, @@ -389,6 +393,7 @@ get_changed_events (ECalBackendExchange status_tracking = EX_READ_AND_DELIVERED; } + e_cal_backend_exchange_cache_lock (cbex); if (!e_cal_backend_exchange_in_cache (cbex, uid, modtime, result->href)) { g_ptr_array_add (hrefs, g_strdup (result->href)); g_hash_table_insert (modtimes, g_strdup (result->href), @@ -397,6 +402,7 @@ get_changed_events (ECalBackendExchange g_hash_table_insert (attachments, g_strdup (result->href), g_strdup (uid)); } + e_cal_backend_exchange_cache_unlock (cbex); } status = e2k_result_iter_free (iter); @@ -408,8 +414,10 @@ get_changed_events (ECalBackendExchange return status; } + e_cal_backend_exchange_cache_lock (cbex); if (!since) e_cal_backend_exchange_cache_sync_end (cbex); + e_cal_backend_exchange_cache_unlock (cbex); if (!hrefs->len) { g_ptr_array_free (hrefs, TRUE); @@ -469,12 +477,14 @@ get_changed_events (ECalBackendExchange if (!SOUP_STATUS_IS_SUCCESSFUL (status)) { g_ptr_array_free (hrefs, TRUE); g_hash_table_destroy (modtimes); + g_hash_table_destroy (attachments); g_mutex_unlock (cbexc->priv->mutex); return status; } if (!hrefs->len) { g_ptr_array_free (hrefs, TRUE); g_hash_table_destroy (modtimes); + g_hash_table_destroy (attachments); cbexc->priv->is_loaded = TRUE; g_mutex_unlock (cbexc->priv->mutex); return SOUP_STATUS_OK; @@ -696,6 +706,7 @@ create_object (ECalBackendSync *backend, { /* FIXME : Return some value in uid */ ECalBackendExchangeCalendar *cbexc; + ECalBackendExchange *cbex; icalcomponent *icalcomp, *real_icalcomp; icalcomponent_kind kind; icalproperty *icalprop; @@ -719,6 +730,7 @@ create_object (ECalBackendSync *backend, d(printf ("ecbexc_create_object(%p, %p, %s, %s)", backend, cal, *calobj ? *calobj : NULL, *uid ? *uid : NULL)); cbexc = E_CAL_BACKEND_EXCHANGE_CALENDAR (backend); + cbex = E_CAL_BACKEND_EXCHANGE (backend); g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), GNOME_Evolution_Calendar_InvalidObject); g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_InvalidObject); @@ -881,8 +893,10 @@ create_object (ECalBackendSync *backend, return GNOME_Evolution_Calendar_OtherError; } + e_cal_backend_exchange_cache_lock (cbex); /*add object*/ e_cal_backend_exchange_add_object (E_CAL_BACKEND_EXCHANGE (cbexc), location, lastmod, icalcomp); + e_cal_backend_exchange_cache_unlock (cbex); *uid = g_strdup (temp_comp_uid); g_object_unref (comp); @@ -1011,9 +1025,14 @@ modify_object (ECalBackendSync *backend, const char *calobj, CalObjModType mod, char **old_object, char **new_object) { + ECalBackendSyncStatus status; + ECalBackendExchange *cbex = E_CAL_BACKEND_EXCHANGE (backend); + d(printf ("ecbexc_modify_object(%p, %p, %d, %s)", backend, cal, mod, *old_object ? *old_object : NULL)); - return modify_object_with_href (backend, cal, calobj, mod, old_object, new_object, NULL, NULL); + status = modify_object_with_href (backend, cal, calobj, mod, old_object, new_object, NULL, NULL); + + return status; } static ECalBackendSyncStatus @@ -1023,6 +1042,7 @@ modify_object_with_href (ECalBackendSync { ECalBackendExchangeCalendar *cbexc; ECalBackendExchangeComponent *ecomp; + ECalBackendExchange *cbex; icalcomponent *icalcomp, *real_icalcomp, *updated_icalcomp; ECalComponent *real_ecomp, *cached_ecomp = NULL, *updated_ecomp; const char *comp_uid; @@ -1047,6 +1067,7 @@ modify_object_with_href (ECalBackendSync gboolean remove = FALSE; cbexc = E_CAL_BACKEND_EXCHANGE_CALENDAR (backend); + cbex = E_CAL_BACKEND_EXCHANGE (backend); g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), GNOME_Evolution_Calendar_InvalidObject); g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_InvalidObject); @@ -1076,11 +1097,12 @@ modify_object_with_href (ECalBackendSync else key_rid = icaltime_from_string (rid_to_remove); - - ecomp = get_exchange_comp (E_CAL_BACKEND_EXCHANGE (cbexc), comp_uid); + e_cal_backend_exchange_cache_lock (cbex); + ecomp = get_exchange_comp (cbex, comp_uid); if (!ecomp){ icalcomponent_free (icalcomp); + e_cal_backend_exchange_cache_unlock (cbex); return GNOME_Evolution_Calendar_ObjectNotFound; } @@ -1149,6 +1171,7 @@ modify_object_with_href (ECalBackendSync g_free (updated_ecomp_str); if (!updated_icalcomp) { g_object_unref (updated_ecomp); + e_cal_backend_exchange_cache_unlock (cbex); return GNOME_Evolution_Calendar_OtherError; } @@ -1169,6 +1192,7 @@ modify_object_with_href (ECalBackendSync if (!e_cal_component_set_icalcomponent (real_ecomp, updated_icalcomp)) { g_object_unref (real_ecomp); g_object_unref (updated_ecomp); + e_cal_backend_exchange_cache_unlock (cbex); return GNOME_Evolution_Calendar_OtherError; } @@ -1257,6 +1281,7 @@ modify_object_with_href (ECalBackendSync g_object_unref (updated_ecomp); icalcomponent_free (cbdata->vcal_comp); g_free (cbdata); + e_cal_backend_exchange_cache_unlock (cbex); return GNOME_Evolution_Calendar_OtherError; } real_icalcomp = icalparser_parse_string (real_comp_str); @@ -1297,6 +1322,8 @@ modify_object_with_href (ECalBackendSync } } + e_cal_backend_exchange_cache_unlock (cbex); + if (!cached_ecomp && remove) *new_object = g_strdup (icalcomponent_as_ical_string (icalcomp)); @@ -1371,9 +1398,12 @@ modify_object_with_href (ECalBackendSync if ((E2K_HTTP_STATUS_IS_SUCCESSFUL (http_status)) && send_options) http_status = e2k_context_proppatch (ctx, NULL, new_href, props, FALSE, NULL); - if (E2K_HTTP_STATUS_IS_SUCCESSFUL (http_status)) + if (E2K_HTTP_STATUS_IS_SUCCESSFUL (http_status)) { + e_cal_backend_exchange_cache_lock (cbex); e_cal_backend_exchange_modify_object (E_CAL_BACKEND_EXCHANGE (cbexc), e_cal_component_get_icalcomponent (real_ecomp), mod, remove); + e_cal_backend_exchange_cache_unlock (cbex); + } if (!remove) *new_object = e_cal_component_get_as_string (real_ecomp); @@ -1398,6 +1428,7 @@ remove_object (ECalBackendSync *backend, char **old_object, char **object) { ECalBackendExchangeCalendar *cbexc; + ECalBackendExchange *cbex; ECalBackendExchangeComponent *ecomp; E2kHTTPStatus status; E2kContext *ctx; @@ -1411,6 +1442,7 @@ remove_object (ECalBackendSync *backend, handled. */ cbexc = E_CAL_BACKEND_EXCHANGE_CALENDAR (backend); + cbex = E_CAL_BACKEND_EXCHANGE (backend); g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), GNOME_Evolution_Calendar_InvalidObject); @@ -1419,10 +1451,13 @@ remove_object (ECalBackendSync *backend, return GNOME_Evolution_Calendar_InvalidObject; } + e_cal_backend_exchange_cache_lock (cbex); ecomp = get_exchange_comp (E_CAL_BACKEND_EXCHANGE (cbexc), uid); - if (!ecomp) + if (!ecomp) { + e_cal_backend_exchange_cache_unlock (cbex); return GNOME_Evolution_Calendar_ObjectNotFound; + } comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (ecomp->icomp)); @@ -1439,6 +1474,8 @@ remove_object (ECalBackendSync *backend, time_rid = icaltime_from_string (rid); e_cal_util_remove_instances (ecomp->icomp, time_rid, mod); calobj = (char *) icalcomponent_as_ical_string (ecomp->icomp); + + e_cal_backend_exchange_cache_unlock (cbex); ebs_status = modify_object_with_href (backend, cal, calobj, mod, &obj, &new_object, NULL, rid); g_object_unref (comp); if (ebs_status != GNOME_Evolution_Calendar_Success) @@ -1451,16 +1488,21 @@ remove_object (ECalBackendSync *backend, g_free (new_object); return ebs_status; - } + } else + e_cal_backend_exchange_cache_unlock (cbex); + g_object_unref (comp); ctx = exchange_account_get_context (E_CAL_BACKEND_EXCHANGE (cbexc)->account); status = e2k_context_delete (ctx, NULL, ecomp->href); if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) { + e_cal_backend_exchange_cache_lock (cbex); if (e_cal_backend_exchange_remove_object (E_CAL_BACKEND_EXCHANGE (cbexc), uid)) { + e_cal_backend_exchange_cache_unlock (cbex); return GNOME_Evolution_Calendar_Success; } + e_cal_backend_exchange_cache_unlock (cbex); } *object = NULL; @@ -1474,6 +1516,7 @@ receive_objects (ECalBackendSync *backen { d(printf ("ecbexc_modify_object(%p, %p, %s)", backend, cal, calobj ? calobj : NULL)); ECalBackendExchangeCalendar *cbexc; + ECalBackendExchange *cbex; ECalBackendExchangeComponent *ecomp; ECalComponent *comp = NULL; GList *comps, *l; @@ -1483,6 +1526,7 @@ receive_objects (ECalBackendSync *backen ECalBackendSyncStatus status = GNOME_Evolution_Calendar_Success; cbexc = E_CAL_BACKEND_EXCHANGE_CALENDAR (backend); + cbex = E_CAL_BACKEND_EXCHANGE (backend); g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (cbexc), GNOME_Evolution_Calendar_InvalidObject); g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_InvalidObject); @@ -1523,11 +1567,13 @@ receive_objects (ECalBackendSync *backen case ICAL_METHOD_PUBLISH: case ICAL_METHOD_REQUEST: case ICAL_METHOD_REPLY: + e_cal_backend_exchange_cache_lock (cbex); if ((ecomp = get_exchange_comp (E_CAL_BACKEND_EXCHANGE (cbexc), uid)) != NULL ) { char *old_object = NULL; d(printf ("uid : %s : found in the cache\n", uid)); + e_cal_backend_exchange_cache_unlock (cbex); if (check_owner_partstatus_for_declined (backend, subcomp)) { ECalComponentId *id = NULL; status = remove_object (backend, cal, uid, NULL, @@ -1567,6 +1613,8 @@ receive_objects (ECalBackendSync *backen char *returned_uid, *old, *object; icalobj = (char *) icalcomponent_as_ical_string (subcomp); d(printf ("Create a new object : %s\n", icalobj)); + + e_cal_backend_exchange_cache_unlock (cbex); status = create_object (backend, cal, &icalobj, &returned_uid); if (status != GNOME_Evolution_Calendar_Success) goto error; @@ -1575,8 +1623,11 @@ receive_objects (ECalBackendSync *backen e_cal_backend_notify_object_created (E_CAL_BACKEND (backend), icalobj); g_free (object); d(printf ("Notify that the new object is created : %s\n", icalobj)); - } else + } else { + e_cal_backend_exchange_cache_unlock (cbex); status = GNOME_Evolution_Calendar_Success; + } + break; case ICAL_METHOD_ADD: /* FIXME This should be doable once all the recurid stuff is done ??*/ @@ -1726,7 +1777,10 @@ book_resource (ECalBackendExchange *cbex e_cal_component_get_uid (E_CAL_COMPONENT (comp), &uid); href = g_strdup_printf ("%s/%s.EML", cal_uri, uid); + + e_cal_backend_exchange_cache_lock (cbex); ecomp = get_exchange_comp (E_CAL_BACKEND_EXCHANGE (cbex), uid); + e_cal_backend_exchange_cache_unlock (cbex); if (method == ICAL_METHOD_CANCEL) { char *object = NULL; @@ -2072,10 +2126,13 @@ discard_alarm (ECalBackendSync *backend, cbex = E_CAL_BACKEND_EXCHANGE (backend); + e_cal_backend_exchange_cache_lock (cbex); ecbexcomp = get_exchange_comp (cbex, uid); - if (!ecbexcomp) + if (!ecbexcomp) { + e_cal_backend_exchange_cache_unlock (cbex); return GNOME_Evolution_Calendar_ObjectNotFound; + } ecomp = e_cal_component_new (); e_cal_component_set_icalcomponent (ecomp, icalcomponent_new_clone (ecbexcomp->icomp)); @@ -2093,6 +2150,7 @@ discard_alarm (ECalBackendSync *backend, } g_object_unref (ecomp); + e_cal_backend_exchange_cache_unlock (cbex); return result; } Index: calendar/e-cal-backend-exchange-tasks.c =================================================================== RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange-tasks.c,v retrieving revision 1.24 diff -u -p -r1.24 e-cal-backend-exchange-tasks.c --- calendar/e-cal-backend-exchange-tasks.c 6 Mar 2006 06:33:02 -0000 1.24 +++ calendar/e-cal-backend-exchange-tasks.c 27 Apr 2006 11:33:24 -0000 @@ -588,6 +588,8 @@ get_changed_tasks (ECalBackendExchange * rn = e2k_restriction_prop_string (E2K_PR_DAV_CONTENT_CLASS, E2K_RELOP_EQ, "urn:content-classes:task"); + + e_cal_backend_exchange_cache_lock (cbex); if (since) { rn = e2k_restriction_andv (rn, e2k_restriction_prop_date ( @@ -597,6 +599,7 @@ get_changed_tasks (ECalBackendExchange * NULL); } else e_cal_backend_exchange_cache_sync_start (cbex); + e_cal_backend_exchange_cache_unlock (cbex); if (cbex->private_item_restriction) { e2k_restriction_ref (cbex->private_item_restriction); @@ -633,11 +636,13 @@ get_changed_tasks (ECalBackendExchange * modtime = e2k_properties_get_prop (result->props, E2K_PR_DAV_LAST_MODIFIED); + e_cal_backend_exchange_cache_lock (cbex); if (!e_cal_backend_exchange_in_cache (cbex, uid, modtime, result->href)) { g_ptr_array_add (hrefs, g_strdup (result->href)); g_hash_table_insert (modtimes, g_strdup (result->href), g_strdup (modtime)); } + e_cal_backend_exchange_cache_unlock (cbex); e_cal_backend_exchange_add_timezone (cbex, icalcomp); @@ -816,8 +821,10 @@ get_changed_tasks (ECalBackendExchange * gboolean status = FALSE; icalcomponent_kind kind = icalcomponent_isa (icalcomp); + e_cal_backend_exchange_cache_lock (cbex); status = e_cal_backend_exchange_add_object (cbex, result->href, modtime, icalcomp); + e_cal_backend_exchange_cache_unlock (cbex); if (status && kind == ICAL_VTODO_COMPONENT) e_cal_backend_notify_object_created (E_CAL_BACKEND (cbex), icalcomponent_as_ical_string (icalcomp)); @@ -834,8 +841,10 @@ get_changed_tasks (ECalBackendExchange * return status; } + e_cal_backend_exchange_cache_lock (cbex); if (!since) e_cal_backend_exchange_cache_sync_end (cbex); + e_cal_backend_exchange_cache_unlock (cbex); if (!hrefs->len) { g_ptr_array_free (hrefs, TRUE); @@ -864,6 +873,8 @@ get_changed_tasks (ECalBackendExchange * uid = g_hash_table_lookup (attachments, result->href); /* Fetch component from cache and update it */ + + e_cal_backend_exchange_cache_lock (cbex); ecalbexcomp = get_exchange_comp (cbex, uid); attachment_list = get_attachment (cbex, uid, ical_data->data, ical_data->len); if (attachment_list) { @@ -876,6 +887,7 @@ get_changed_tasks (ECalBackendExchange * g_slist_foreach (attachment_list, (GFunc) g_free, NULL); g_slist_free (attachment_list); } + e_cal_backend_exchange_cache_unlock (cbex); } status = e2k_result_iter_free (iter); @@ -909,6 +921,7 @@ get_changed_tasks (ECalBackendExchange * if (!SOUP_STATUS_IS_SUCCESSFUL (status)) continue; uid = g_hash_table_lookup (attachments, hrefs->pdata[i]); + e_cal_backend_exchange_cache_lock (cbex); /* Fetch component from cache and update it */ ecalbexcomp = get_exchange_comp (cbex, uid); attachment_list = get_attachment (cbex, uid, body, length); @@ -922,6 +935,7 @@ get_changed_tasks (ECalBackendExchange * g_slist_foreach (attachment_list, (GFunc) g_free, NULL); g_slist_free (attachment_list); } + e_cal_backend_exchange_cache_unlock (cbex); g_free (body); } @@ -1060,12 +1074,15 @@ create_task_object (ECalBackendSync *bac return GNOME_Evolution_Calendar_InvalidObject; } + e_cal_backend_exchange_cache_lock (ecalbex); /* check if the object is already present in our cache */ if (e_cal_backend_exchange_in_cache (E_CAL_BACKEND_EXCHANGE (backend), temp_comp_uid, modtime, NULL)) { + e_cal_backend_exchange_cache_unlock (ecalbex); icalcomponent_free (icalcomp); return GNOME_Evolution_Calendar_ObjectIdAlreadyExists; } + e_cal_backend_exchange_cache_unlock (ecalbex); /* Create the cal component */ comp = e_cal_component_new (); @@ -1128,8 +1145,11 @@ create_task_object (ECalBackendSync *bac status = put_body(comp, e2kctx, NULL, location, from_name, from_addr, attach_body_crlf, boundary, NULL); if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) { + e_cal_backend_exchange_cache_lock (ecalbex); e_cal_backend_exchange_add_object (ecalbex, location, modtime, real_icalcomp); + e_cal_backend_exchange_cache_unlock (ecalbex); } + g_free (location); g_free (modtime); } @@ -1190,12 +1210,14 @@ modify_task_object (ECalBackendSync *bac /* Get the uid */ comp_uid = icalcomponent_get_uid (icalcomp); + e_cal_backend_exchange_cache_lock (ecalbex); /* Get the object from our cache */ ecalbexcomp = get_exchange_comp (E_CAL_BACKEND_EXCHANGE (backend), comp_uid); if (!ecalbexcomp) { icalcomponent_free (icalcomp); + e_cal_backend_exchange_cache_unlock (ecalbex); return GNOME_Evolution_Calendar_ObjectNotFound; } @@ -1203,6 +1225,8 @@ modify_task_object (ECalBackendSync *bac e_cal_component_set_icalcomponent (cache_comp, icalcomponent_new_clone (ecalbexcomp->icomp)); *old_object = e_cal_component_get_as_string (cache_comp); g_object_unref (cache_comp); + + e_cal_backend_exchange_cache_unlock (ecalbex); summary = icalcomponent_get_summary (icalcomp); if (!summary) @@ -1243,8 +1267,11 @@ modify_task_object (ECalBackendSync *bac if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status)){ status = put_body(new_comp, e2kctx, NULL, ecalbexcomp->href, from_name, from_addr, attach_body_crlf, boundary, NULL); - if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) + if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status)) { + e_cal_backend_exchange_cache_lock (ecalbex); e_cal_backend_exchange_modify_object (ecalbex, icalcomp, mod, FALSE); + e_cal_backend_exchange_cache_unlock (ecalbex); + } } icalcomponent_free (icalcomp); return GNOME_Evolution_Calendar_Success; @@ -1255,6 +1282,7 @@ receive_task_objects (ECalBackendSync *b const char *calobj) { ECalBackendExchangeTasks *ecalbextask; + ECalBackendExchange *cbex; ECalComponent *ecalcomp; GList *comps, *l; struct icaltimetype current; @@ -1263,6 +1291,7 @@ receive_task_objects (ECalBackendSync *b ECalBackendSyncStatus status = GNOME_Evolution_Calendar_Success; ecalbextask = E_CAL_BACKEND_EXCHANGE_TASKS (backend); + cbex = E_CAL_BACKEND_EXCHANGE (backend); g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_TASKS (ecalbextask), GNOME_Evolution_Calendar_NoSuchCal); @@ -1298,8 +1327,11 @@ receive_task_objects (ECalBackendSync *b /*see if the object is there in the cache. if found, modify object, else create object*/ + e_cal_backend_exchange_cache_lock (cbex); if (get_exchange_comp (E_CAL_BACKEND_EXCHANGE (ecalbextask), uid)) { char *old_object; + + e_cal_backend_exchange_cache_unlock (cbex); status = modify_task_object (backend, cal, calobj, CALOBJ_MOD_THIS, &old_object, NULL); if (status != GNOME_Evolution_Calendar_Success) goto error; @@ -1308,6 +1340,8 @@ receive_task_objects (ECalBackendSync *b g_free (old_object); } else { char *returned_uid; + + e_cal_backend_exchange_cache_unlock (cbex); calobj = (char *) icalcomponent_as_ical_string (subcomp); status = create_task_object (backend, cal, &calobj, &returned_uid); if (status != GNOME_Evolution_Calendar_Success) @@ -1341,14 +1375,20 @@ remove_task_object (ECalBackendSync *bac return GNOME_Evolution_Calendar_InvalidObject; } + e_cal_backend_exchange_cache_lock (ecalbex); ecalbexcomp = get_exchange_comp (ecalbex, uid); - if (!ecalbexcomp || !ecalbexcomp->href) + + if (!ecalbexcomp || !ecalbexcomp->href) { + e_cal_backend_exchange_cache_unlock (ecalbex); return GNOME_Evolution_Calendar_ObjectNotFound; + } comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (ecalbexcomp->icomp)); *old_object = e_cal_component_get_as_string (comp); g_object_unref (comp); + + e_cal_backend_exchange_cache_unlock (ecalbex); ctx = exchange_account_get_context (ecalbex->account);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor