mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 7.4.1592
Problem: Quickfix code using memory after being freed. (Dominique Pelle) Solution: Detect that the window was closed. (Hirohito Higashi)
This commit is contained in:
parent
5584df65a0
commit
0899d69803
@ -1795,8 +1795,19 @@ win_found:
|
|||||||
oldwin == curwin ? curwin : NULL);
|
oldwin == curwin ? curwin : NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ok = buflist_getfile(qf_ptr->qf_fnum,
|
ok = buflist_getfile(qf_ptr->qf_fnum,
|
||||||
(linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit);
|
(linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit);
|
||||||
|
if (qi != &ql_info && !win_valid(oldwin))
|
||||||
|
{
|
||||||
|
EMSG(_("E924: Current window was closed"));
|
||||||
|
ok = FALSE;
|
||||||
|
qi = NULL;
|
||||||
|
qf_ptr = NULL;
|
||||||
|
opened_window = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok == OK)
|
if (ok == OK)
|
||||||
@ -1899,7 +1910,7 @@ win_found:
|
|||||||
if (opened_window)
|
if (opened_window)
|
||||||
win_close(curwin, TRUE); /* Close opened window */
|
win_close(curwin, TRUE); /* Close opened window */
|
||||||
#endif
|
#endif
|
||||||
if (qf_ptr->qf_fnum != 0)
|
if (qf_ptr != NULL && qf_ptr->qf_fnum != 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Couldn't open file, so put index back where it was. This could
|
* Couldn't open file, so put index back where it was. This could
|
||||||
@ -1913,8 +1924,11 @@ failed:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
theend:
|
theend:
|
||||||
qi->qf_lists[qi->qf_curlist].qf_ptr = qf_ptr;
|
if (qi != NULL)
|
||||||
qi->qf_lists[qi->qf_curlist].qf_index = qf_index;
|
{
|
||||||
|
qi->qf_lists[qi->qf_curlist].qf_ptr = qf_ptr;
|
||||||
|
qi->qf_lists[qi->qf_curlist].qf_index = qf_index;
|
||||||
|
}
|
||||||
#ifdef FEAT_WINDOWS
|
#ifdef FEAT_WINDOWS
|
||||||
if (p_swb != old_swb && opened_window)
|
if (p_swb != old_swb && opened_window)
|
||||||
{
|
{
|
||||||
|
@ -495,3 +495,22 @@ function Test_locationlist()
|
|||||||
|
|
||||||
augroup! testgroup
|
augroup! testgroup
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function Test_locationlist_curwin_was_closed()
|
||||||
|
augroup testgroup
|
||||||
|
au!
|
||||||
|
autocmd BufReadCmd t call R(expand("<amatch>"))
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
function R(n)
|
||||||
|
quit
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
new
|
||||||
|
let q = []
|
||||||
|
call add(q, {'filename': 't' })
|
||||||
|
call setloclist(0, q)
|
||||||
|
call assert_fails('lrewind', 'E924:')
|
||||||
|
|
||||||
|
augroup! testgroup
|
||||||
|
endfunction
|
||||||
|
@ -748,6 +748,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1592,
|
||||||
/**/
|
/**/
|
||||||
1591,
|
1591,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user