--- src/doc/PdfPage.cpp
+++ src/doc/PdfPage.cpp
@@ -439,7 +439,10 @@
     }
     else
     {
-        this->DeleteAnnotation( pItem->GetReference() );
+        // Create local copy of item reference, since item will be erased from array,
+        // invalidating the returned reference object.
+        const PdfReference ref = pItem->GetReference();
+        this->DeleteAnnotation( ref );
     }
 }
 
