[evince/gnome-3-8] libview: Don't update current_page to negative number



commit 0a63affb774d854bc973770b9065a08fc13e66d0
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Thu Jun 13 16:15:35 2013 -0700

    libview: Don't update current_page to negative number
    
    In continuous mode with dual page view, there is a chance
    that the pages were outside of the scroll view.  When
    opening a document in such circumstances, the current
    page should not be updated to a negative number when
    already has the first page as default.
    
    This fixes a crash when searching with a negative
    current page.
    
    Fix https://bugzilla.gnome.org/show_bug.cgi?id=683172

 libview/ev-view.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 6bda520..74b2781 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -739,7 +739,7 @@ view_update_range_and_current_page (EvView *view)
                if (view->pending_scroll == SCROLL_TO_KEEP_POSITION) {
                        best_current_page = MAX (best_current_page, view->start_page);
 
-                       if (view->current_page != best_current_page) {
+                       if (best_current_page >= 0 && view->current_page != best_current_page) {
                                view->current_page = best_current_page;
                                ev_view_set_loading (view, FALSE);
                                ev_document_model_set_page (view->model, best_current_page);
@@ -5997,6 +5997,8 @@ ev_view_find_started (EvView *view, EvJobFind *job)
 void
 ev_view_find_changed (EvView *view, GList **results, gint page)
 {
+       g_return_if_fail (view->current_page >= 0);
+
        view->find_pages = results;
        
        if (view->jump_to_find_result == TRUE) {


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