Skip to content

Commit

Permalink
fix: free current_index_path when close docs or set to a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
laomuon authored and sebastinas committed Aug 10, 2024
1 parent 4717796 commit b787fad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions zathura/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ void index_scroll_to_current_page(zathura_t* zathura) {
gtk_tree_model_foreach(model, search_current_index, &search_data);

GtkTreePath* current_path = gtk_tree_model_get_path(model, &search_data.current_iter);
g_free(zathura->global.current_index_path);
zathura->global.current_index_path = gtk_tree_path_to_string(current_path);
gtk_tree_view_expand_to_path(tree_view, current_path);

Expand Down
3 changes: 3 additions & 0 deletions zathura/zathura.c
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,9 @@ bool document_close(zathura_t* zathura, bool keep_monitor) {
zathura->ui.index = NULL;
}

/* free current index path */
g_free(zathura->global.current_index_path);

gtk_widget_hide(zathura->ui.page_widget);

statusbar_page_number_update(zathura);
Expand Down
2 changes: 1 addition & 1 deletion zathura/zathura.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ struct zathura_s {
GdkModifierType synctex_edit_modmask; /**< Modifier to trigger synctex edit */
GdkModifierType highlighter_modmask; /**< Modifier to draw with a highlighter */
bool double_click_follow; /**< Double/Single click to follow link */
char *current_index_path;
gchar *current_index_path;
} global;

struct {
Expand Down

0 comments on commit b787fad

Please sign in to comment.