[poppler] poppler/Annot.cc

Pino Toscano pino at kemper.freedesktop.org
Tue Mar 1 06:39:21 PST 2011


 poppler/Annot.cc |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 58a3b83a8fbd8b13eb98c4f677f4ed19b6ae44cd
Author: Pino Toscano <pino at kde.org>
Date:   Tue Mar 1 15:35:45 2011 +0100

    fix appendAnnot() invocation on annotations reading
    
    1) check that the annot is actually a non-NULL pointer (otherwise doing anything else is pointless)
    2) call appendAnnot() only if the annotation isOk() (that will increase the annot refcount), but always decrement the refcount (so valid annotation will have it at 1, while invalid will be deleted)

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 5a5ba2e..d55d665 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -5274,8 +5274,12 @@ Annots::Annots(XRef *xref, Catalog *catalog, Object *annotsObj) {
       if (annotsObj->arrayGet(i, &obj1)->isDict()) {
         annotsObj->arrayGetNF(i, &obj2);
         annot = createAnnot (xref, obj1.getDict(), catalog, &obj2);
-        appendAnnot(annot);
-        annot->decRefCnt();
+        if (annot) {
+          if (annot->isOk()) {
+            appendAnnot(annot);
+          }
+          annot->decRefCnt();
+        }
       }
       obj2.free();
       obj1.free();


More information about the poppler mailing list