Commit feff531e authored by Germán Poo-Caamaño's avatar Germán Poo-Caamaño
Browse files

Check legal boundaries of accessible pages (revisited)

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 https://bugzilla.gnome.org/show_bug.cgi?id=735744
parent 5e73b292
......@@ -389,6 +389,14 @@ 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;
}
static void
......@@ -577,16 +585,8 @@ ev_view_accessible_set_page_range (EvViewAccessible *accessible,
g_return_if_fail (EV_IS_VIEW_ACCESSIBLE (accessible));
/* When a document is reloaded, the accessible->priv->children is
* cleaned up and updated with the new document information.
* In specific cases, where the document is smaller, priv->end_page
* will be higher than the current number of pages. Therefore, we
* check the number of pages to avoid access to non-existent pages
* in priv->children).
* See https://bugzilla.gnome.org/show_bug.cgi?id=735744
*/
for (i = accessible->priv->start_page; i <= accessible->priv->end_page; i++) {
if ((i < start || i > end) && i < ev_view_accessible_get_n_pages (accessible)) {
if (i < start || i > end) {
page = g_ptr_array_index (accessible->priv->children, i);
atk_object_notify_state_change (page, ATK_STATE_SHOWING, FALSE);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment