diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-04-13 19:05:22 +0100 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-04-13 19:08:43 +0100 |
commit | 5efb018a4a3c0bc2c1733c9c7933652e60680599 (patch) | |
tree | 69bec2f02ab920018dcc19b790c7be676e086ec4 | |
parent | 36ed57c8558d233447d6497c197bfa5d48a14e8f (diff) | |
download | telepathy-logger-5efb018a4a3c0bc2c1733c9c7933652e60680599.tar.gz |
Leak a single GTimeZone
...to avoid crashes when freeing them.
See https://bugzilla.gnome.org/show_bug.cgi?id=646435
-rw-r--r-- | telepathy-logger/util.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/telepathy-logger/util.c b/telepathy-logger/util.c index ee0b582..03b9269 100644 --- a/telepathy-logger/util.c +++ b/telepathy-logger/util.c @@ -61,6 +61,9 @@ _tpl_rmdir_recursively (const gchar *dir_name) dir_name, g_strerror (errno)); } +/* We leak a single tz struct as freeing them is not thread-safe, + * see https://bugzilla.gnome.org/show_bug.cgi?id=646435 */ +static GTimeZone *tz; /* The format is: "20021209T23:51:30" and is in UTC. 0 is returned on * failure. The alternative format "20021209" is also accepted. @@ -85,7 +88,10 @@ _tpl_time_parse (const gchar *str) if (n_parsed != 3 && n_parsed != 6) return 0; - dt = g_date_time_new_utc (year, month, day, hour, min, sec); + if (G_UNLIKELY (tz == NULL)) + tz = g_time_zone_new_utc (); + + dt = g_date_time_new (tz, year, month, day, hour, min, sec); ts = g_date_time_to_unix (dt); g_date_time_unref (dt); |