summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-page.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/pdf/pdf-page.c')
-rw-r--r--source/pdf/pdf-page.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c
index 7f9a00e3..ba080340 100644
--- a/source/pdf/pdf-page.c
+++ b/source/pdf/pdf-page.c
@@ -882,15 +882,14 @@ pdf_drop_page_imp(fz_context *ctx, pdf_page *page)
{
pdf_document *doc = page->doc;
+ /* We are about to destroy the annotation records for this page and so,
+ * if doc->focus refers to one of them, it must be NULLed */
+ if (doc->focus && doc->focus->page == page)
+ doc->focus = NULL;
+
fz_drop_link(ctx, page->links);
pdf_drop_annots(ctx, page->annots);
- /* doc->focus, when not NULL, refers to one of
- * the annotations and must be NULLed when the
- * annotations are destroyed. doc->focus_obj
- * keeps track of the actual annotation object. */
- doc->focus = NULL;
-
pdf_drop_obj(ctx, page->obj);
fz_drop_document(ctx, &page->doc->super);