diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2013-11-06 16:51:20 +0000 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2013-11-06 16:51:20 +0000 |
commit | 2880476b2ee10fd8b6e258da5f5c2b7a93746a07 (patch) | |
tree | 4bc1df0139f9876a4535d83d2538ea5868c5c334 /source | |
parent | 2901c7d78c9880b6fda7ccf9b000d847724071e4 (diff) | |
download | mupdf-2880476b2ee10fd8b6e258da5f5c2b7a93746a07.tar.xz |
Place newly created annotations at the end of the annotation list
This fixes bug 694755. Thank you to Michael Cadihac for the patch
Diffstat (limited to 'source')
-rw-r--r-- | source/pdf/pdf-annot.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c index 338ca1ac..edab4cd5 100644 --- a/source/pdf/pdf-annot.c +++ b/source/pdf/pdf-annot.c @@ -710,6 +710,7 @@ pdf_create_annot(pdf_document *doc, pdf_page *page, fz_annot_type type) { fz_context *ctx = doc->ctx; pdf_annot *annot = NULL; + pdf_annot **lastptr; pdf_obj *annot_obj = pdf_new_dict(doc, 0); pdf_obj *ind_obj = NULL; @@ -753,10 +754,12 @@ pdf_create_annot(pdf_document *doc, pdf_page *page, fz_annot_type type) /* Linking must be done after any call that might throw because - pdf_free_annot below actually frees a list + pdf_free_annot below actually frees a list. Put the new annot + at the end of the list, so that it will be drawn last. */ - annot->next = page->annots; - page->annots = annot; + for (lastptr = &page->annots; *lastptr; lastptr = &(*lastptr)->next) + ; + *lastptr = annot; doc->dirty = 1; } |