From 60d7ff988b458c65d9537d4d489347b1b44f399b Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Mon, 24 May 2021 16:31:47 +0000 Subject: [PATCH] [pdf-interchange] Write trees even if only LINK tags are present This avoids the PDF ending up with invalid xref entries for objects that were "reserved" but then never output. Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/487. --- src/cairo-pdf-interchange.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cairo-pdf-interchange.c b/src/cairo-pdf-interchange.c index 0f896d351..540b3174d 100644 --- a/src/cairo-pdf-interchange.c +++ b/src/cairo-pdf-interchange.c @@ -1373,7 +1373,8 @@ _cairo_pdf_interchange_write_document_objects (cairo_pdf_surface_t *surface) cairo_tag_stack_structure_type_t tag_type; tag_type = _cairo_tag_stack_get_structure_type (&ic->analysis_tag_stack); - if (tag_type == TAG_TREE_TYPE_TAGGED || tag_type == TAG_TREE_TYPE_STRUCTURE) { + if (tag_type == TAG_TREE_TYPE_TAGGED || tag_type == TAG_TREE_TYPE_STRUCTURE || + tag_type == TAG_TREE_TYPE_LINK_ONLY) { status = cairo_pdf_interchange_write_parent_tree (surface); if (unlikely (status))