[cairo] cairo_debug_reset_static_data() and pango crashing.

mike e Toqoz at hotmail.com
Sat Jul 2 09:14:51 UTC 2016


Hi, I've been scratching my head a bit over what looks like a bug with cairo_debug_reset_static_data.


Whenever I use "drawing operations" (that's the best that I can explain it) from pangocairo, the program will fail on the call to cairo_debug_reset_static_data() with:


draw: cairo-hash.c:217: _cairo_hash_table_destroy: Assertion `hash_table->live_entries == 0' failed.


The API warns that using the reset call may cause such an error if there are active cairo objects in use, but the code works perfectly without the pango calls in place.

Here's the bare-bones code, the program runs fine if both lines are commented.  If either are not commented, the error will occur:


#include <cairo.h>
#include <pango/pangocairo.h>

int
main (int argc, char *argv[])
{
    cairo_surface_t *surface;
    cairo_t *context;

    surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 120, 120);
    context = cairo_create(surface);

    PangoRectangle extents;
    PangoLayout *layout;
    PangoFontDescription *desc;

    layout = pango_cairo_create_layout (context);

    desc = pango_font_description_from_string("Inconsolata 12");
    pango_layout_set_font_description(layout, desc);
    pango_font_description_free(desc);

    pango_layout_set_markup(layout, "hello", -1);
    //pango_layout_get_pixel_extents(layout, &extents, NULL);

    //pango_cairo_show_layout(context, layout);

    g_object_unref(layout);
    cairo_destroy(context);
    cairo_surface_destroy(surface);

    cairo_debug_reset_static_data();

    return(0);
}



I hope I am not missing something obvious!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20160702/b53c001f/attachment.html>


More information about the cairo mailing list