From e3575888c1b7569bc862879dd7da7cbd081d87a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Poo-Caama=C3=B1o?= Date: Thu, 13 Jun 2013 16:15:35 -0700 Subject: 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 origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=8fe6917 --- libview/ev-view.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libview') diff --git a/libview/ev-view.c b/libview/ev-view.c index 9125e361..14a9fae0 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -754,7 +754,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; hide_loading_window (view); ev_document_model_set_page (view->model, best_current_page); @@ -6332,6 +6332,7 @@ jump_to_find_page (EvView *view, EvViewFindDirection direction, gint shift) 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) { -- cgit v1.2.1