summaryrefslogtreecommitdiff
path: root/pango/pangofc-fontmap.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-08-27 23:33:16 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-08-27 23:33:16 -0400
commit503ad16e979dae995ed200e512d734fa6691ecef (patch)
tree5b70a7450301944d0837b53b426dd8184a7171d0 /pango/pangofc-fontmap.c
parentf160843b9afab5d8f39654580d7583cf49b0c242 (diff)
downloadpango-503ad16e979dae995ed200e512d734fa6691ecef.tar.gz
Make pangofc-fontmap.c thread-safe
Diffstat (limited to 'pango/pangofc-fontmap.c')
-rw-r--r--pango/pangofc-fontmap.c10
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 (&registered_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(&registered_modules, 1);
}
priv->n_families = -1;