Discussion:
[zathura] [Zathura PATCH] Move calls to zathura_jumplist_add surrounding zathura_link_evaluate to zathura_link_evaluate itself
Marwan Tanager
2013-06-21 08:02:19 UTC
Permalink
This is just in case that zathura_link_evaluate returns without evaluating the
link, which would result in a new jump being added for the current position,
but without adding a corresponding jump for the target position (actually a
second one would be added but the check in zathura_jumplist_add would prevent
it from being appended on the linked list since it's position would be the same
as the current one, because the link haven't been evaluated).

---
callbacks.c | 5 -----
links.c | 4 ++++
2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/callbacks.c b/callbacks.c
index 1212b1d..b9dca4b 100644
--- a/callbacks.c
+++ b/callbacks.c
@@ -274,10 +274,7 @@ cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
}

sc_toggle_index(zathura->ui.session, NULL, NULL, 0);
-
- /* zathura_jumplist_save is called when entering index mode */
zathura_link_evaluate(zathura, index_element->link);
- zathura_jumplist_add(zathura);
}

g_object_unref(model);
@@ -333,9 +330,7 @@ handle_link(GtkEntry* entry, girara_session_t* session,
invalid_index = false;
switch (action) {
case ZATHURA_LINK_ACTION_FOLLOW:
- zathura_jumplist_add(zathura);
zathura_link_evaluate(zathura, link);
- zathura_jumplist_add(zathura);
break;
case ZATHURA_LINK_ACTION_DISPLAY:
zathura_link_display(zathura, link);
diff --git a/links.c b/links.c
index 968b983..dc5a837 100644
--- a/links.c
+++ b/links.c
@@ -149,6 +149,8 @@ zathura_link_evaluate(zathura_t* zathura, zathura_link_t* link)
}
}

+ zathura_jumplist_add(zathura);
+
/* jump to the page */
page_set(zathura, link->target.page_number);

@@ -161,6 +163,8 @@ zathura_link_evaluate(zathura_t* zathura, zathura_link_t* link)
} else {
position_set(zathura, -1, offset.y);
}
+
+ zathura_jumplist_add(zathura);
}
break;
case ZATHURA_LINK_GOTO_REMOTE:
--
1.7.10.4
Loading...