--- poppler/Page.cc 2017-06-17 18:35:25.000000000 +0200 +++ poppler/Page.cc 2017-07-15 09:48:22.307451500 +0200 @@ -487,6 +487,7 @@ void Page::removeAnnot(Annot *annot) { annArray.free(); return; } + annot->removeReferencedObjects(); annots->removeAnnot(annot); // Gracefully fails on popup windows annArray.arrayRemove(idx); xref->removeIndirectObject(annotRef); @@ -496,10 +497,11 @@ void Page::removeAnnot(Annot *annot) { } else { xref->setModifiedObject (&pageObj, pageRef); } + } else { + annot->removeReferencedObjects(); + annot->setPage(0, gFalse); } annArray.free(); - annot->removeReferencedObjects(); // Note: Might recurse in removeAnnot again - annot->setPage(0, gFalse); } Links *Page::getLinks() {