From f2c6b77550898e52d594637b9395f9b001c6be7a Mon Sep 17 00:00:00 2001 From: Paul Gardiner Date: Wed, 8 Aug 2018 16:40:17 +0100 Subject: 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. --- source/pdf/pdf-page.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source') 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); -- cgit v1.2.3