Assertion `! scaled_font->cache_frozen' failed

Bin Wu <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Hi
Assertion: cairo-1.15.2/src/cairo-scaled-font.c:1317: cairo_scaled_font_destroy: Assertion `! scaled_font->cache_frozen' failed.

This happens in calling cairo_glyph_extents when several threads work on scaled_font.

Cairo_scaled_font_destroy is obviously unsafe for multithread, so the assertion may be triggered occasionally.

In my situation, following patch can solve my trouble
------------------------ cairo/src/cairo-scaled-font.c ------------------------
index ac80c97..bea10f4 100644
@@ -1314,6 +1314,8 @@ cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)
     if (! _cairo_reference_count_dec_and_test (&scaled_font->ref_count))
        return;

+    CAIRO_MUTEX_LOCK(scaled_font->mutex);
+
     assert (! scaled_font->cache_frozen);
     assert (! scaled_font->global_cache_frozen);

@@ -1357,7 +1359,7 @@ cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)

   unlock:
     _cairo_scaled_font_map_unlock ();
-
+    CAIRO_MUTEX_UNLOCK(scaled_font->mutex);
     /* If we pulled an item from the holdovers array, (while the font
      * map lock was held, of course), then there is no way that anyone
      * else could have acquired a reference to it. So we can now

So will cairo_scaled_font_destroy be optimized in further release?

BR
Bin Wu

-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.