Commit aee96d17 authored by Uli Schlachter's avatar Uli Schlachter

Initialize mutexes in _cairo_ft_unscaled_font_map_lock()

This function is reachable via cairo_ft_font_face_create_for_ft_face()
-> _cairo_ft_unscaled_font_create_from_face() ->
_cairo_ft_unscaled_font_create_internal() ->
_cairo_ft_unscaled_font_map_lock(). Thus, it could happen that nothing
initialized mutexes before this code runs.
Signed-off-by: Uli Schlachter's avatarUli Schlachter <psychon@znc.in>
parent 0ae4e6a8
Pipeline #113518 failed with stage
in 6 minutes and 41 seconds
......@@ -370,6 +370,8 @@ _cairo_ft_unscaled_font_map_destroy (void)
static cairo_ft_unscaled_font_map_t *
_cairo_ft_unscaled_font_map_lock (void)
{
CAIRO_MUTEX_INITIALIZE ();
  • Is mutex initialization thread safe ?

  • No. Definitely not. Look at _cairo_mutex_initialize() in src/cairo-mutex.c, if you want to know the scary details.

  • oh oh. I thought glib has a once_init call that will take care of this ?

    Edited by Aaron Boxer
  • Cairo does not depend on glib. GLib also offers mutexes that would simplify cairo-mutex.c a lot.

Please register or sign in to reply
CAIRO_MUTEX_LOCK (_cairo_ft_unscaled_font_map_mutex);
if (unlikely (cairo_ft_unscaled_font_map == NULL)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment