diff options
author | Milan Crha <mcrha@redhat.com> | 2015-11-25 09:02:32 +0100 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2015-11-25 09:04:04 +0100 |
commit | 41a388df9b9a69ffff7eecb0e846c7a6e2a44210 (patch) | |
tree | fb77ee8379c54420ec4ebc72176be5173ea845a3 | |
parent | 7ce14019da29bd9d05624c45fc0b3b74657a2b88 (diff) | |
download | evolution-data-server-41a388df9b9a69ffff7eecb0e846c7a6e2a44210.tar.gz |
Bug 746675 - Workaround thread unsafety of icaltimezone_load_builtin_timezone()
-rw-r--r-- | calendar/libedata-cal/e-subprocess-cal-factory.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/calendar/libedata-cal/e-subprocess-cal-factory.c b/calendar/libedata-cal/e-subprocess-cal-factory.c index c26868464..0537a46da 100644 --- a/calendar/libedata-cal/e-subprocess-cal-factory.c +++ b/calendar/libedata-cal/e-subprocess-cal-factory.c @@ -137,6 +137,36 @@ ESubprocessCalFactory * e_subprocess_cal_factory_new (GCancellable *cancellable, GError **error) { + icalarray *builtin_timezones; + gint ii; + +#ifdef HAVE_ICAL_UNKNOWN_TOKEN_HANDLING + ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN); +#endif + + /* XXX Pre-load all built-in timezones in libical. + * + * Built-in time zones in libical 0.43 are loaded on demand, + * but not in a thread-safe manner, resulting in a race when + * multiple threads call icaltimezone_load_builtin_timezone() + * on the same time zone. Until built-in time zone loading + * in libical is made thread-safe, work around the issue by + * loading all built-in time zones now, so libical's internal + * time zone array will be fully populated before any threads + * are spawned. + */ + builtin_timezones = icaltimezone_get_builtin_timezones (); + for (ii = 0; ii < builtin_timezones->num_elements; ii++) { + icaltimezone *zone; + + zone = icalarray_element_at (builtin_timezones, ii); + + /* We don't care about the component right now, + * we just need some function that will trigger + * icaltimezone_load_builtin_timezone(). */ + icaltimezone_get_component (zone); + } + return g_initable_new ( E_TYPE_SUBPROCESS_CAL_FACTORY, cancellable, error, NULL); |