]> granicus.if.org Git - vim/commitdiff
patch 8.0.0605: the quickfix cached buffer may become invalid v8.0.0605
authorBram Moolenaar <Bram@vim.org>
Sun, 28 May 2017 05:56:36 +0000 (07:56 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 28 May 2017 05:56:36 +0000 (07:56 +0200)
Problem:    The buffer that quickfix caches for performance may become
            invalid. (Daniel Hahler)
Solution:   Reset qf_last_bufref in qf_init_ext(). (Daniel Hahler,
            closes #1728, closes #1676)

src/quickfix.c
src/version.c

index 9626cfa43009249f5ec54e240986a798d785456d..ce21661a655aa88b721767dd628356f0408258bb 100644 (file)
@@ -157,6 +157,13 @@ static qf_info_T *ll_get_or_alloc_list(win_T *);
  */
 #define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? wp->w_llist_ref : wp->w_llist)
 
+/*
+ * Looking up a buffer can be slow if there are many.  Remember the last one
+ * to make this a lot faster if there are multiple matches in the same file.
+ */
+static char_u *qf_last_bufname = NULL;
+static bufref_T  qf_last_bufref = {NULL, 0};
+
 /*
  * Read the errorfile "efile" into memory, line by line, building the error
  * list. Set the error list's title to qf_title.
@@ -1151,6 +1158,10 @@ qf_init_ext(
     int                    retval = -1;        /* default: return error flag */
     int                    status;
 
+    /* Do not used the cached buffer, it may have been wiped out. */
+    vim_free(qf_last_bufname);
+    qf_last_bufname = NULL;
+
     vim_memset(&state, 0, sizeof(state));
     vim_memset(&fields, 0, sizeof(fields));
 #ifdef FEAT_MBYTE
@@ -1659,13 +1670,6 @@ copy_loclist(win_T *from, win_T *to)
     to->w_llist->qf_curlist = qi->qf_curlist;  /* current list */
 }
 
-/*
- * Looking up a buffer can be slow if there are many.  Remember the last one
- * to make this a lot faster if there are multiple matches in the same file.
- */
-static char_u *qf_last_bufname = NULL;
-static bufref_T  qf_last_bufref = {NULL, 0};
-
 /*
  * Get buffer number for file "directory/fname".
  * Also sets the b_has_qf_entry flag.
index bc80ace7410567443b145750e795bf66160fd07b..2c5aa06fde2cbb8c20d78f54aad0f8bbea28fc30 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    605,
 /**/
     604,
 /**/