summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermán Poo-Caamaño <[email protected]>2016-02-18 16:44:40 -0800
committerraveit65 <[email protected]>2018-03-16 16:15:10 +0100
commite79d2665e8a4c80d7650e96906545579cb1bf930 (patch)
tree112710f4245a1777d19a116e0f08ff83f9f824e7
parent291facd39c8375ef79697469e9b1ed374d37ef85 (diff)
downloadatril-e79d2665e8a4c80d7650e96906545579cb1bf930.tar.bz2
atril-e79d2665e8a4c80d7650e96906545579cb1bf930.tar.xz
Check legal boundaries of accessible pages
Fixes https://github.com/mate-desktop/atril/issues/302 Keep the accessible view end page under the limits of the document. Sometimes when a document is reloaded, it may have less pages making the end page higher than the actual number of pages. Fix end_page reset after reload a page When a document is reloaded, and the accessible end_page is higher than the number of pages, it must be re-initialized to the number of pages minus one because it refers to elements in an array. Fix https://bugzilla.gnome.org/show_bug.cgi?id=735744 origin commits: https://git.gnome.org/browse/evince/commit/?id=feff531 https://git.gnome.org/browse/evince/commit/?id=e6e0d29
-rw-r--r--libview/ev-view-accessible.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libview/ev-view-accessible.c b/libview/ev-view-accessible.c
index d48c97c7..8274aced 100644
--- a/libview/ev-view-accessible.c
+++ b/libview/ev-view-accessible.c
@@ -380,6 +380,13 @@ initialize_children (EvViewAccessible *self)
child = ev_page_accessible_new (self, i);
g_ptr_array_add (self->priv->children, child);
}
+ /* When a document is reloaded, it may have less pages.
+ * We need to update the end page accordingly to avoid
+ * invalid access to self->priv->children
+ * See https://bugzilla.gnome.org/show_bug.cgi?id=735744
+ */
+ if (self->priv->end_page >= n_pages)
+ self->priv->end_page = n_pages - 1;
}
static void