[evince] Check legal boundaries of accessible pages



commit 5e73b292406c1f9559dc9d8ad71a120a28cbb8d1
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Tue Feb 16 16:40:39 2016 -0800

    Check legal boundaries of accessible pages
    
    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 nonexistent pages
    in priv->children).
    
    Fix https://bugzilla.gnome.org/show_bug.cgi?id=735744

 libview/ev-view-accessible.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/libview/ev-view-accessible.c b/libview/ev-view-accessible.c
index 7805219..f3cd3dd 100644
--- a/libview/ev-view-accessible.c
+++ b/libview/ev-view-accessible.c
@@ -577,8 +577,16 @@ 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) {
+               if ((i < start || i > end) && i < ev_view_accessible_get_n_pages (accessible)) {
                        page = g_ptr_array_index (accessible->priv->children, i);
                        atk_object_notify_state_change (page, ATK_STATE_SHOWING, FALSE);
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]