Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
text_cache_crash.c File Reference
#include "cairo_test.h"
#include <cairo.h>

Go to the source code of this file.


static void draw (cairo_t *cr, int width, int height)
int main (void)


cairo_test_t test

Function Documentation

static void draw ( cairo_t *  cr,
int  width,
int  height 
) [static]

Definition at line 73 of file text_cache_crash.c.

    /* Once there was a bug that choked when selecting the same font twice. */
    cairo_select_font(cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    cairo_scale_font(cr, 40.0);

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

    /* Then there was a bug that choked when selecting a font too big
     * for the cache. */

/* XXX: Sometimes this leads to an assertion:

_cairo_cache_lookup: Assertion `cache->max_memory >= (cache->used_memory + new_entry->memory)' failed.

   But other times my machine hangs completely only to return to life
   several minutes later with some programs missing. This seems like
   the out-of-memory killer to me.

   It seems like I usually get the assertion when I run
   ./text_cache_crash directly and I usually get the machine hang when
   I run "make check" but I don't know if there's a perfect
   correlation there.

   So there's a bad bug here somewhere that really needs to be fixed.
   But in the meantime, I need "make check" not to destory work, so
   I'm commenting this test out for now.

    cairo_scale_font (cr, 500);
    cairo_show_text (cr, "hello");

Here is the caller graph for this function:

int main ( void  )

Definition at line 111 of file text_cache_crash.c.

    int ret;

    ret = cairo_test (&test, draw);

    /* It's convenient to be able to free all memory (including
     * statically allocated memory). This makes it quite easy to use
     * tools such as valgrind to verify that there are no memory leaks
     * whatsoever.
     * But I'm not sure what would be a sensible cairo API function
     * for this. The cairo_destroy_caches call below is just something
     * I made as a local modification to cairo.
    cairo_destroy_caches ();
    FcFini ();

    return ret;

Here is the call graph for this function:

Variable Documentation

Initial value:
    "Test case for bug causing an assertion failure in _cairo_cache_lookup",
    0, 0,

Definition at line 65 of file text_cache_crash.c.