Created attachment 111131 [details]
A minimum code which reproduces this.
When my program calls cairo_debug_reset_static_data, it crashes with assertion failure.
I found it happens after toy font faces are created and destroyed.
I would attach a minimum code which reproduces it.
$ make toy CFLAGS=`pkg-config --cflags cairo` LDFLAGS=`pkg-config --libs cairo`
toy: cairo-hash.c:217: _cairo_hash_table_destroy: Assersion `hash_table->live_entries == 0' failed.
$ pkg-config --modversion cairo
git bisect ends with
337ab1f8d9e29086bfb4001508b28835b41c6390 is the first bad commit
Author: Chris Wilson <firstname.lastname@example.org>
Date: Tue Sep 17 16:28:19 2013 +0100
and that commit introduced in cairo/src/cairo-font-face.c a
function __put () that hardly returns 0, it returns the ref
count before decreasing it (unless it is 1) and is called in
2 places like this:
assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&font_face->ref_count));
if (__put (&font_face->ref_count))
if (! font_face->backend->destroy (font_face))
and the second if is not executed even in a single threaded
Created attachment 111176 [details] [review]
This seems to be related to the issue I had mentioned here:
Thank you for prodding me again, I now have patch which should fix it (i.e. in your reduced case and in the api-special-cases test).
Can you confirm that it also works in more complex scenarios?
In the next couple of days I will be quite busy, but if somebody reviews it, I will push it to master.
Thank you for the fix.
It seems ok. At least my code works fine with the proposed fix.
(In reply to Andrea Canciani from comment #2)
> Created attachment 111176 [details] [review] [review]
> Proposed fix
> This seems to be related to the issue I had mentioned here:
> Thank you for prodding me again, I now have patch which should fix it (i.e.
> in your reduced case and in the api-special-cases test).
> Can you confirm that it also works in more complex scenarios?
> In the next couple of days I will be quite busy, but if somebody reviews it,
> I will push it to master.
Yes, looks correct. Thanks.
Should be fixed in master by:
Author: Andrea Canciani <email@example.com>
Date: Mon Dec 22 12:49:00 2014 +0100
font: Actually perform destruction of fonts
Commit 337ab1f8d9e29086bfb4001508b28835b41c6390 introduced delayed
font destruction to overcome a race, but prevented the correct cleanup
of the font cache.
This caused fonts to stay in the cache and caused a crash in the
api-special-cases (when running the test suite with -f).