[evolution/gnome-2-32] Bug 628139 - Thread-safety issues in libical time zone loading
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-2-32] Bug 628139 - Thread-safety issues in libical time zone loading
- Date: Fri, 5 Nov 2010 10:50:18 +0000 (UTC)
commit 751062392476d04934cee60231507632a489fdf3
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Nov 5 11:49:47 2010 +0100
Bug 628139 - Thread-safety issues in libical time zone loading
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 134f706..749dd7e 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]