[cairo] cairo_font_face_t not freeing

Louis M prog at tioui.com
Tue May 2 12:05:06 UTC 2017


On Tue, 2 May 2017 14:55:20 +1200, Lawrence D'Oliveiro wrote:

>     You are looking at garbage pointed to by an invalid pointer.

Hi Lawrence and thank you for your answer,

I am sorry. Maybe I was not clear enough in my previous email. I removed some lines of code to keep my example minimal. I know that the pointer seems like an invalid pointer in my example, but it is not. We can see that by replacing those two lines:

    cairo_font_face_destroy(font_face);
    printf("Refcount=%d\n", cairo_font_face_get_reference_count(font_face));

By those three lines:

    printf("Refcount before freeing=%d\n", cairo_font_face_get_reference_count(font_face));
    cairo_font_face_destroy(font_face);
    printf("Refcount after freeing=%d\n", cairo_font_face_get_reference_count(font_face));

The pointer before the 'cairo_font_face_destroy' should be valid because I didn't free the it yet. The output of this example program is this:

Refcount before freeing=2
Refcount after freeing=1

Thanks,

Louis

 




More information about the cairo mailing list