From e90d30ba31ad20b63ee207c062f6fdf43ea91669 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Wed, 13 Sep 2017 19:55:21 +0200 Subject: Drop rasterizer upon error while bounding path. --- source/fitz/draw-device.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 8c7ce352..72498322 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -2580,11 +2580,17 @@ fz_bound_path_accurate(fz_context *ctx, fz_irect *bbox, const fz_irect *scissor, { fz_rasterizer *rast = fz_new_rasterizer(ctx, NULL); - if (stroke) - (void)fz_flatten_stroke_path(ctx, rast, path, stroke, ctm, flatness, linewidth, scissor, bbox); - else - (void)fz_flatten_fill_path(ctx, rast, path, ctm, flatness, scissor, bbox); - fz_drop_rasterizer(ctx, rast); + fz_try(ctx) + { + if (stroke) + (void)fz_flatten_stroke_path(ctx, rast, path, stroke, ctm, flatness, linewidth, scissor, bbox); + else + (void)fz_flatten_fill_path(ctx, rast, path, ctm, flatness, scissor, bbox); + } + fz_always(ctx) + fz_drop_rasterizer(ctx, rast); + fz_catch(ctx) + fz_rethrow(ctx); return bbox; } -- cgit v1.2.3