diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-10-31 23:31:10 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-31 23:31:10 +0800 |
commit | 855ae5eed1eeae0cfe271a5a47d6fb8abf21d691 (patch) | |
tree | a479a662ec22d3e9f01f0b0153c7fcce9a058ee4 /modules | |
parent | 4170492c5a86f1f2ca6a78eb7419421bd76ee6a4 (diff) | |
download | gsoc2013-evolution-855ae5eed1eeae0cfe271a5a47d6fb8abf21d691.tar.gz gsoc2013-evolution-855ae5eed1eeae0cfe271a5a47d6fb8abf21d691.tar.zst gsoc2013-evolution-855ae5eed1eeae0cfe271a5a47d6fb8abf21d691.zip |
Bug 628139 - Thread-safety issues in libical time zone loading
Diffstat (limited to 'modules')
-rw-r--r-- | modules/calendar/e-cal-shell-backend.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 134f706054..749dd7ec19 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -769,8 +769,34 @@ cal_shell_backend_class_init (ECalShellBackendClass *class) static void cal_shell_backend_init (ECalShellBackend *cal_shell_backend) { + icalarray *builtin_timezones; + gint ii; + cal_shell_backend->priv = E_CAL_SHELL_BACKEND_GET_PRIVATE (cal_shell_backend); + + /* 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); + } } GType |