diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2018-09-26 03:09:35 +0800 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-10-24 17:11:22 +0200 |
commit | 75e7fd0e6ea72ecfe369030b5d1879b0c594da52 (patch) | |
tree | 1d6f349414922984c18d8e503de61fd55f34c73d | |
parent | 54728872f059b0422e392f92cc988f3a50ff117c (diff) | |
download | mupdf-75e7fd0e6ea72ecfe369030b5d1879b0c594da52.tar.xz |
Since fz_end_group may throw, don't call it inside fz_always.
If running the page throws an exception, we don't need to call end_group since
the page interpretation is aborted and won't be finished.
-rw-r--r-- | source/pdf/pdf-run.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/pdf/pdf-run.c b/source/pdf/pdf-run.c index b0364435..94c21207 100644 --- a/source/pdf/pdf-run.c +++ b/source/pdf/pdf-run.c @@ -92,27 +92,27 @@ pdf_run_page_contents_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *p colorspace = fz_keep_colorspace(ctx, fz_default_output_intent(ctx, default_cs)); fz_begin_group(ctx, dev, mediabox, colorspace, 1, 0, 0, 1); - fz_drop_colorspace(ctx, colorspace); - colorspace = NULL; } proc = pdf_new_run_processor(ctx, dev, ctm, usage, NULL, default_cs); pdf_process_contents(ctx, proc, doc, resources, contents, cookie); pdf_close_processor(ctx, proc); + + if (page->transparency) + { + fz_end_group(ctx, dev); + } } fz_always(ctx) { - fz_drop_default_colorspaces(ctx, default_cs); pdf_drop_processor(ctx, proc); + fz_drop_colorspace(ctx, colorspace); + fz_drop_default_colorspaces(ctx, default_cs); } fz_catch(ctx) { - fz_drop_colorspace(ctx, colorspace); fz_rethrow(ctx); } - - if (page->transparency) - fz_end_group(ctx, dev); } void pdf_run_page_contents(fz_context *ctx, pdf_page *page, fz_device *dev, fz_matrix ctm, fz_cookie *cookie) |