Description: Free index if document gets closed.
 Otherwise, if the currently opened documents gets refreshed and the document's
 index did change, zathura would display the old index.
Origin: http://git.pwmt.org/?p=zathura.git;a=commit;h=f239ea14
Last-Update: 2012-05-10
Bug: http://bt.pwmt.org/view.php?id=169

diff --git a/zathura.c b/zathura.c
index 240629c..0c22258 100644
--- a/zathura.c
+++ b/zathura.c
@@ -721,6 +721,12 @@ document_close(zathura_t* zathura, bool keep_monitor)
   zathura_document_free(zathura->document);
   zathura->document = NULL;
 
+  /* remove index */
+  if (zathura->ui.index != NULL) {
+    g_object_ref_sink(zathura->ui.index);
+    zathura->ui.index = NULL;
+  }
+
   gtk_widget_hide(zathura->ui.page_widget);
 
   statusbar_page_number_update(zathura);
