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). --- source/fitz/svg-device.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/fitz/svg-device.c') diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index 1a486545..8a7f4bf9 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -1063,23 +1063,28 @@ svg_dev_end_tile(fz_context *ctx, fz_device *dev) } static void -svg_dev_close(fz_context *ctx, fz_device *dev) +svg_dev_close_device(fz_context *ctx, fz_device *dev) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; + fz_printf(ctx, out, "\n"); +} +static void +svg_dev_drop_device(fz_context *ctx, fz_device *dev) +{ + svg_device *sdev = (svg_device*)dev; fz_free(ctx, sdev->tiles); fz_drop_buffer(ctx, sdev->defs_buffer); fz_drop_output(ctx, sdev->defs); - - fz_printf(ctx, out, "\n"); } fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, float page_height) { svg_device *dev = fz_new_device(ctx, sizeof *dev); - dev->super.close = svg_dev_close; + dev->super.close_device = svg_dev_close_device; + dev->super.drop_device = svg_dev_drop_device; dev->super.fill_path = svg_dev_fill_path; dev->super.stroke_path = svg_dev_stroke_path; -- cgit v1.2.3