From 10d6eaa73164b58c91ae8a4537b8a8589038a01d Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 8 Jul 2016 12:04:35 +0200 Subject: 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). --- docs/multi-threaded.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs') diff --git a/docs/multi-threaded.c b/docs/multi-threaded.c index 6f07b543..15fdcba2 100644 --- a/docs/multi-threaded.c +++ b/docs/multi-threaded.c @@ -96,6 +96,7 @@ renderer(void *data) fprintf(stderr, "thread at page %d rendering!\n", pagenumber); dev = fz_new_draw_device(ctx, &fz_identity, pix); fz_run_display_list(ctx, list, dev, &fz_identity, &bbox, NULL); + fz_close_device(ctx, dev); fz_drop_device(ctx, dev); // This threads context is freed. @@ -212,6 +213,7 @@ int main(int argc, char **argv) dev = fz_new_list_device(ctx, list); fz_run_page(ctx, page, dev, &fz_identity, NULL); + fz_close_device(ctx, dev); fz_drop_device(ctx, dev); // The page is no longer needed, all drawing commands -- cgit v1.2.3