fix double free and failed assertions in cairo_scaled_font_destroy

This commit is contained in:
Michal Sudolsky 2020-07-21 20:02:24 +02:00 committed by Uli Schlachter
parent f896701502
commit a67735010d

8
src/cairo-scaled-font.c Normal file → Executable file
View file

@ -1320,15 +1320,15 @@ cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)
assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&scaled_font->ref_count));
font_map = _cairo_scaled_font_map_lock ();
assert (font_map != NULL);
if (! _cairo_reference_count_dec_and_test (&scaled_font->ref_count))
return;
goto unlock;
assert (! scaled_font->cache_frozen);
assert (! scaled_font->global_cache_frozen);
font_map = _cairo_scaled_font_map_lock ();
assert (font_map != NULL);
/* Another thread may have resurrected the font whilst we waited */
if (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&scaled_font->ref_count)) {
if (! scaled_font->placeholder &&