summaryrefslogtreecommitdiff
path: root/source/xps
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/xps
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/xps')
-rw-r--r--source/xps/xps-doc.c4
-rw-r--r--source/xps/xps-zip.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/source/xps/xps-doc.c b/source/xps/xps-doc.c
index 95008e72..fb4511f4 100644
--- a/source/xps/xps-doc.c
+++ b/source/xps/xps-doc.c
@@ -414,7 +414,7 @@ xps_bound_page(fz_context *ctx, xps_page *page, fz_rect *bounds)
return bounds;
}
-void
+static void
xps_drop_page_imp(fz_context *ctx, xps_page *page)
{
if (page == NULL)
@@ -444,7 +444,7 @@ xps_load_page(fz_context *ctx, xps_document *doc, int number)
page->super.load_links = (fz_page_load_links_fn *)xps_load_links;
page->super.bound_page = (fz_page_bound_page_fn *)xps_bound_page;
page->super.run_page_contents = (fz_page_run_page_contents_fn *)xps_run_page;
- page->super.drop_page_imp = (fz_page_drop_page_imp_fn *)xps_drop_page_imp;
+ page->super.drop_page = (fz_page_drop_page_fn *)xps_drop_page_imp;
page->doc = (xps_document*) fz_keep_document(ctx, &doc->super);
page->fix = fix;
diff --git a/source/xps/xps-zip.c b/source/xps/xps-zip.c
index b0c4403a..2bf0391f 100644
--- a/source/xps/xps-zip.c
+++ b/source/xps/xps-zip.c
@@ -134,7 +134,7 @@ xps_open_document_with_directory(fz_context *ctx, const char *directory)
}
fz_catch(ctx)
{
- xps_close_document(ctx, doc);
+ xps_drop_document(ctx, doc);
fz_rethrow(ctx);
}
@@ -156,7 +156,7 @@ xps_open_document_with_stream(fz_context *ctx, fz_stream *file)
}
fz_catch(ctx)
{
- xps_close_document(ctx, doc);
+ xps_drop_document(ctx, doc);
fz_rethrow(ctx);
}
@@ -194,7 +194,7 @@ xps_open_document(fz_context *ctx, const char *filename)
}
void
-xps_close_document(fz_context *ctx, xps_document *doc)
+xps_drop_document(fz_context *ctx, xps_document *doc)
{
xps_font_cache *font, *next;
@@ -232,7 +232,7 @@ static void
xps_init_document(fz_context *ctx, xps_document *doc)
{
doc->super.refs = 1;
- doc->super.close = (fz_document_close_fn *)xps_close_document;
+ doc->super.drop_document = (fz_document_drop_fn *)xps_drop_document;
doc->super.load_outline = (fz_document_load_outline_fn *)xps_load_outline;
doc->super.count_pages = (fz_document_count_pages_fn *)xps_count_pages;
doc->super.load_page = (fz_document_load_page_fn *)xps_load_page;