diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-07-08 12:04:35 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-07-08 17:21:24 +0200 |
commit | 10d6eaa73164b58c91ae8a4537b8a8589038a01d (patch) | |
tree | 5b739b0c2202b42a9079ee3ecbd98c3d3b09b124 /source/tools/muraster.c | |
parent | b53e7a42f7cc9756ed9fa1fed313271e3ae67855 (diff) | |
download | mupdf-10d6eaa73164b58c91ae8a4537b8a8589038a01d.tar.xz |
Separate close and drop functionality for devices and writers.
Closing a device or writer may throw exceptions, but much of the
foreign language bindings (JNI and JS) depend on drop to never throw
an exception (exceptions in finalizers are bad).
Diffstat (limited to 'source/tools/muraster.c')
-rw-r--r-- | source/tools/muraster.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/tools/muraster.c b/source/tools/muraster.c index e5d886f4..6a2cf87e 100644 --- a/source/tools/muraster.c +++ b/source/tools/muraster.c @@ -710,6 +710,7 @@ static int drawband(fz_context *ctx, fz_page *page, fz_display_list *list, const fz_run_display_list(ctx, list, dev, ctm, tbounds, cookie); else fz_run_page(ctx, page, dev, ctm, cookie); + fz_close_device(ctx, dev); fz_drop_device(ctx, dev); dev = NULL; @@ -726,12 +727,10 @@ static int drawband(fz_context *ctx, fz_page *page, fz_display_list *list, const static int dodrawpage(fz_context *ctx, int pagenum, fz_cookie *cookie, render_details *render) { - fz_device *dev = NULL; fz_pixmap *pix = NULL; fz_bitmap *bit = NULL; int errors_are_fatal = 0; - fz_var(dev); fz_var(pix); fz_var(bit); fz_var(errors_are_fatal); @@ -852,8 +851,6 @@ static int dodrawpage(fz_context *ctx, int pagenum, fz_cookie *cookie, render_de { fz_drop_bitmap(ctx, bit); bit = NULL; - fz_drop_device(ctx, dev); - dev = NULL; if (render->num_workers > 0) { int band; @@ -1198,9 +1195,11 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) #if GREY_FALLBACK != 0 test_dev = fz_new_test_device(ctx, &is_color, 0.01f, 0, list_dev); fz_run_page(ctx, page, test_dev, &fz_identity, &cookie); + fz_close_device(ctx, test_dev); #else fz_run_page(ctx, page, list_dev, &fz_identity, &cookie); #endif + fz_close_device(ctx, list_dev); } fz_always(ctx) { @@ -1229,6 +1228,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) { test_dev = fz_new_test_device(ctx, &is_color, 0.01f, 0, test_dev); fz_run_page(ctx, page, test_dev, &fz_identity, &cookie); + fz_close_device(ctx, test_dev); } fz_always(ctx) { @@ -1258,6 +1258,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) fz_run_display_list(ctx, list, test_dev, &fz_identity, &fz_infinite_rect, &cookie); else fz_run_page(ctx, page, test_dev, &fz_identity, &cookie); + fz_close_device(ctx, test_dev); } fz_always(ctx) { |