[cairo] getting assertions [cairo_cache.c:143: _entry_destroy: Assertion `cache->used_memory > entry->memory' failed]

Carl Worth cworth at cworth.org
Thu Nov 4 14:29:47 PST 2004


On Thu, 4 Nov 2004 09:49:38 -0800, Ned Konz wrote:
> I'm working on Squeak bindings for libcairo.
> 
> Mostly things are going OK (this *is* a big API!),

I'm glad it's coming along well. But cairo is still about 20 times
smaller than gtk, so perhaps you should count your blessings. :-)

> but from time to time I get some assertions.
> 
> I'm certain that there's something I don't understand here and am doing wrong
> (I'm not used to manual memory management!),

It doesn't look to me like you are doing anything wrong. The assertion
is all our fault (by definition of course).

I was able to whittle your test case down to something quite small and
reasonable looking that still tickles cairo the wrong way:

    cairo_select_font(cr, "sans", 0, 0);
    cairo_scale_font(cr, 40.0);

    cairo_select_font(cr, "sans", 0, 0);
    cairo_scale_font(cr, 40.0);
    cairo_move_to(cr, 10, 50);
    cairo_show_text(cr, "hello");

The magnitude of the number passed in to cairo_scale_font appears to be
significant. It was failing with 80 in the original code, but it passes
with 20 or 30.

I've committed a test case for this bug to our new regression suite as
cairo/test/text_cache_crash.c.

Thank you very much for the report. I'll go take a dive into Graydon's
cache code now...

-Carl



More information about the cairo mailing list