summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2018-08-08 16:40:17 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-08-21 13:14:58 +0200
commitf2c6b77550898e52d594637b9395f9b001c6be7a (patch)
tree5881b5f347cabab4166b902dcf5701eb155b729a
parent1a4fc8250f89e316c0a8cdb71fa47dd591255176 (diff)
downloadmupdf-f2c6b77550898e52d594637b9395f9b001c6be7a.tar.xz
Avoid unnecessary NULLing of doc->focus
doc->focus refers to a widget record within a specific page. We shouldn't NULL it when dropping a different page.
-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);