[gs-commits] mupdf 1.16.1.epub-prerelease-18 Close down filter process

[email protected] (Tor Andersson) Thu, 31 Oct 2019 12:53:37 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
commit a4bcc86279d6a6b90d8e13a82a3678b1272c57ce
Author: Tor Andersson <[email protected]>
Date:   Mon Sep 16 13:35:12 2019 +0200

    Close down filter processor in "close" callback, not "END" callback.
    
    The END callback is called when hitting the end of a content stream.
    This is not the same as closing down at the end cleanly.
    Currently there's no difference, but should we for example inline
    XObject forms, we will call END for each inlined content stream.

diff --git a/source/pdf/pdf-op-filter.c b/source/pdf/pdf-op-filter.c
index 3a52a06..70a58db 100644
--- a/source/pdf/pdf-op-filter.c
+++ b/source/pdf/pdf-op-filter.c
@@ -1789,6 +1789,15 @@ static void
 pdf_filter_END(fz_context *ctx, pdf_processor *proc)
 {
 	pdf_filter_processor *p = (pdf_filter_processor*)proc;
+	filter_flush(ctx, p, FLUSH_TEXT);
+	if (p->chain->op_END)
+		p->chain->op_END(ctx, p->chain);
+}
+
+static void
+pdf_close_filter_processor(fz_context *ctx, pdf_processor *proc)
+{
+	pdf_filter_processor *p = (pdf_filter_processor*)proc;
 	while (!filter_pop(ctx, p))
 	{
 		/* Nothing to do in the loop, all work done above */
@@ -1881,6 +1890,7 @@ pdf_new_filter_processor_with_text_filter(fz_context *ctx, pdf_document *doc, in
 {
 	pdf_filter_processor *proc = pdf_new_processor(ctx, sizeof *proc);
 	{
+		proc->super.close_processor = pdf_close_filter_processor;
 		proc->super.drop_processor = pdf_drop_filter_processor;
 
 		/* general graphics state */

http://git.ghostscript.com/?p=mupdf.git;a=commit;h=a4bcc86279d6a6b90d8e13a82a3678b1272c57ce

--
MuPDF library
Artifex Software, Inc.