poppler/PDFDoc.cc |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

New commits:
commit d06c27584ecf4b7ff2fe492f0133722ac461dfd6
Author: Thomas Freitag <[email protected]>
Date:   Thu Aug 27 22:16:03 2015 +0200

    File Saving improvements
    
    Refinement of the /P annotation test
    
    Fixes file from comment #8 in bug #87637

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index da95ff0..e99af26 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -26,7 +26,7 @@
 // Copyright (C) 2010 Ilya Gorenbein <[email protected]>
 // Copyright (C) 2010 Srinivas Adicherla <[email protected]>
 // Copyright (C) 2010 Philip Lorenz <[email protected]>
-// Copyright (C) 2011-2014 Thomas Freitag <[email protected]>
+// Copyright (C) 2011-2015 Thomas Freitag <[email protected]>
 // Copyright (C) 2012, 2013 Fabio D'Urso <[email protected]>
 // Copyright (C) 2013, 2014 Adrian Johnson <[email protected]>
 // Copyright (C) 2013 Adam Reichold <[email protected]>
@@ -1612,10 +1612,27 @@ GBool PDFDoc::markAnnotations(Object *annotsObj, XRef 
*xRef, XRef *countRef, Gui
                 type.free();
                 continue;
               } else {
-                array->remove(i);
+                Object page;
+                getXRef()->fetch(obj2.getRef().num, obj2.getRef().gen, &page);
+                if (page.isDict()) {
+                  Object pagetype;
+                  Dict *dict = page.getDict();
+                  dict->lookup("Type", &pagetype);
+                  if (!pagetype.isName() || strcmp(pagetype.getName(), "Page") 
!= 0) {
+                    obj1.free();
+                    obj2.free();
+                    type.free();
+                    page.free();
+                    pagetype.free();
+                    continue;
+                  }
+                  pagetype.free();
+                }
+                page.free();
                 obj1.free();
                 obj2.free();
                 type.free();
+                array->remove(i);
                 modified = gTrue;
                 continue;
               }
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to