Skip to content

Commit e79d266

Browse files
gpooraveit65
authored andcommitted
Check legal boundaries of accessible pages
Fixes #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
1 parent 291facd commit e79d266

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libview/ev-view-accessible.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,13 @@ initialize_children (EvViewAccessible *self)
380380
child = ev_page_accessible_new (self, i);
381381
g_ptr_array_add (self->priv->children, child);
382382
}
383+
/* When a document is reloaded, it may have less pages.
384+
* We need to update the end page accordingly to avoid
385+
* invalid access to self->priv->children
386+
* See https://bugzilla.gnome.org/show_bug.cgi?id=735744
387+
*/
388+
if (self->priv->end_page >= n_pages)
389+
self->priv->end_page = n_pages - 1;
383390
}
384391

385392
static void

0 commit comments

Comments
 (0)