[cairo] segmentation fault during poppler_page_render()

Dan Raymond draymond at foxvalley.net
Sun Mar 8 16:50:10 PDT 2015


Is there something wrong with the following code snippet?  I am getting 
intermittent segmentation faults during poppler_page_render().


    // Paint the drawing area grey and then fill the PDF rendering area 
with white.  This will
    // prevent the background from bleeding through any areas that are 
not rendered by the PDF.

    surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 
window_width, window_height);
    cr = cairo_create(surface);
    cairo_set_source_rgb(cr, 0.33, 0.33, 0.33);  // grey background
    cairo_paint(cr);
    cairo_rectangle(cr, x_padding, y_padding, pdf_width, pdf_height);
    cairo_set_source_rgb(cr, 1, 1, 1);
    cairo_fill(cr);

    // Render the PDF.

    cairo_translate(cr, x_padding, y_padding);
    cairo_scale(cr, scale_factor, scale_factor);
    poppler_page_render(page, cr);
    cairo_destroy(cr);
    // (use the rendered surface here)
    cairo_surface_destroy(surface);



More information about the cairo mailing list