[pango] Make pangofc-fontmap.c thread-safe
- From: Behdad Esfahbod <behdad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango] Make pangofc-fontmap.c thread-safe
- Date: Tue, 28 Aug 2012 04:34:12 +0000 (UTC)
commit 503ad16e979dae995ed200e512d734fa6691ecef
Author: Behdad Esfahbod <behdad behdad org>
Date: Mon Aug 27 23:33:16 2012 -0400
Make pangofc-fontmap.c thread-safe
pango/pangofc-fontmap.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 8315b6b..d4a8fa9 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -299,7 +299,7 @@ get_context_matrix (PangoContext *context,
PangoMatrix *matrix)
{
const PangoMatrix *set_matrix;
- static const PangoMatrix identity = PANGO_MATRIX_INIT;
+ const PangoMatrix identity = PANGO_MATRIX_INIT;
set_matrix = context ? pango_context_get_matrix (context) : NULL;
*matrix = set_matrix ? *set_matrix : identity;
@@ -1015,21 +1015,21 @@ G_DEFINE_ABSTRACT_TYPE (PangoFcFontMap, pango_fc_font_map, PANGO_TYPE_FONT_MAP)
static void
pango_fc_font_map_init (PangoFcFontMap *fcfontmap)
{
- static gboolean registered_modules = FALSE;
+ static gsize registered_modules = 0; /* MT-safe */
PangoFcFontMapPrivate *priv;
priv = fcfontmap->priv = G_TYPE_INSTANCE_GET_PRIVATE (fcfontmap,
PANGO_TYPE_FC_FONT_MAP,
PangoFcFontMapPrivate);
- if (!registered_modules)
+ if (g_once_init_enter (®istered_modules))
{
int i;
- registered_modules = TRUE;
-
for (i = 0; _pango_included_fc_modules[i].list; i++)
pango_module_register (&_pango_included_fc_modules[i]);
+
+ g_once_init_leave(®istered_modules, 1);
}
priv->n_families = -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]