Check errors of cairo_image_surface_create properly

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2015-12-21 02:23:27 +01:00
parent f240bdb93c
commit 6f6e8ea94e
2 changed files with 9 additions and 0 deletions

View file

@ -130,6 +130,11 @@ cb_print_draw_page(GtkPrintOperation* print_operation, GtkPrintContext*
gtk_print_operation_cancel(print_operation); gtk_print_operation_cancel(print_operation);
return; return;
} }
if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
gtk_print_operation_cancel(print_operation);
cairo_surface_destroy(surface);
return;
}
cairo_t* temp_cairo = cairo_create(surface); cairo_t* temp_cairo = cairo_create(surface);
if (cairo == NULL) { if (cairo == NULL) {

View file

@ -746,6 +746,10 @@ render(render_job_t* job, ZathuraRenderRequest* request, ZathuraRenderer* render
if (surface == NULL) { if (surface == NULL) {
return false; return false;
} }
if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
cairo_surface_destroy(surface);
return false;
}
cairo_t* cairo = cairo_create(surface); cairo_t* cairo = cairo_create(surface);
if (cairo == NULL) { if (cairo == NULL) {