<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi, I've been scratching my head a bit over what looks like a bug with cairo_debug_reset_static_data.</p>
<p><br>
</p>
<p>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: </p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">draw: cairo-hash.c:217: _cairo_hash_table_destroy: Assertion `hash_table->live_entries == 0' failed.</span></p>
<p><br>
</p>
<p>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.</p>
<p>Here's the bare-bones code, the program runs fine if both lines are commented.  If either are not commented, the error will occur:</p>
<p><br>
</p>
<p></p>
<div>#include <cairo.h></div>
<div>#include <pango/pangocairo.h></div>
<div><br>
</div>
<div>int</div>
<div>main (int argc, char *argv[])</div>
<div>{</div>
<div>    cairo_surface_t *surface;</div>
<div>    cairo_t *context;</div>
<div><br>
</div>
<div>    surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 120, 120);</div>
<div>    context = cairo_create(surface);</div>
<div><br>
</div>
<div>    PangoRectangle extents;</div>
<div>    PangoLayout *layout;</div>
<div>    PangoFontDescription *desc;</div>
<div><br>
</div>
<div>    layout = pango_cairo_create_layout (context);</div>
<div><br>
</div>
<div>    desc = pango_font_description_from_string("Inconsolata 12");</div>
<div>    pango_layout_set_font_description(layout, desc);</div>
<div>    pango_font_description_free(desc);</div>
<div><br>
</div>
<div>    pango_layout_set_markup(layout, "hello", -1);</div>
<div>    //pango_layout_get_pixel_extents(layout, &extents, NULL);</div>
<div><br>
</div>
<div>    //pango_cairo_show_layout(context, layout);</div>
<div><br>
</div>
<div>    g_object_unref(layout);</div>
<div>    cairo_destroy(context);</div>
<div>    cairo_surface_destroy(surface);</div>
<div><br>
</div>
<div>    cairo_debug_reset_static_data();</div>
<div><br>
</div>
<div>    return(0);</div>
<div>}</div>
<div><br>
</div>
<br>
<p></p>
<p><span style="font-size: 12pt;"></span></p>
<div>I hope I am not missing something obvious!</div>
<p></p>
</div>
</body>
</html>