summaryrefslogtreecommitdiff
path: root/source/fitz/writer.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/writer.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/writer.c')
-rw-r--r--source/fitz/writer.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/fitz/writer.c b/source/fitz/writer.c
index 556e01a8..c4e95e2a 100644
--- a/source/fitz/writer.c
+++ b/source/fitz/writer.c
@@ -67,16 +67,18 @@ fz_new_document_writer(fz_context *ctx, const char *path, const char *format, co
void
fz_close_document_writer(fz_context *ctx, fz_document_writer *wri)
{
- if (wri->close)
- wri->close(ctx, wri);
- wri->close = NULL;
+ if (wri->close_writer)
+ wri->close_writer(ctx, wri);
+ wri->close_writer = NULL;
}
void
fz_drop_document_writer(fz_context *ctx, fz_document_writer *wri)
{
- if (wri->close)
- wri->close(ctx, wri);
+ if (wri->close_writer)
+ fz_warn(ctx, "dropping unclosed document writer");
+ if (wri->drop_writer)
+ wri->drop_writer(ctx, wri);
fz_free(ctx, wri);
}