summaryrefslogtreecommitdiff
path: root/source/fitz/svg-device.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-07-08 12:04:35 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-07-08 17:21:24 +0200
commit10d6eaa73164b58c91ae8a4537b8a8589038a01d (patch)
tree5b739b0c2202b42a9079ee3ecbd98c3d3b09b124 /source/fitz/svg-device.c
parentb53e7a42f7cc9756ed9fa1fed313271e3ae67855 (diff)
downloadmupdf-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/fitz/svg-device.c')
-rw-r--r--source/fitz/svg-device.c13
1 files changed, 9 insertions, 4 deletions
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, "</svg>\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, "</svg>\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;