diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2012-08-27 23:33:16 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2012-08-27 23:33:16 -0400 |
commit | 503ad16e979dae995ed200e512d734fa6691ecef (patch) | |
tree | 5b70a7450301944d0837b53b426dd8184a7171d0 /pango/pangofc-fontmap.c | |
parent | f160843b9afab5d8f39654580d7583cf49b0c242 (diff) | |
download | pango-503ad16e979dae995ed200e512d734fa6691ecef.tar.gz |
Make pangofc-fontmap.c thread-safe
Diffstat (limited to 'pango/pangofc-fontmap.c')
-rw-r--r-- | 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 8315b6b3..d4a8fa96 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; |