mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 15:28:17 +00:00
vim-patch:7.4.1592
Problem: Quickfix code using memory after being freed. (Dominique Pelle)
Solution: Detect that the window was closed. (Hirohito Higashi)
0899d69803
This commit is contained in:
@@ -1581,9 +1581,17 @@ win_found:
|
||||
ok = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1,
|
||||
ECMD_HIDE + ECMD_SET_HELP,
|
||||
oldwin == curwin ? curwin : NULL);
|
||||
} else
|
||||
} else {
|
||||
ok = buflist_getfile(qf_ptr->qf_fnum,
|
||||
(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) {
|
||||
@@ -1665,7 +1673,7 @@ win_found:
|
||||
} else {
|
||||
if (opened_window)
|
||||
win_close(curwin, TRUE); /* Close opened window */
|
||||
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
|
||||
* happen if the file was readonly and we changed something.
|
||||
@@ -1676,8 +1684,10 @@ failed:
|
||||
}
|
||||
}
|
||||
theend:
|
||||
qi->qf_lists[qi->qf_curlist].qf_ptr = qf_ptr;
|
||||
qi->qf_lists[qi->qf_curlist].qf_index = qf_index;
|
||||
if (qi != NULL) {
|
||||
qi->qf_lists[qi->qf_curlist].qf_ptr = qf_ptr;
|
||||
qi->qf_lists[qi->qf_curlist].qf_index = qf_index;
|
||||
}
|
||||
if (p_swb != old_swb && opened_window) {
|
||||
/* Restore old 'switchbuf' value, but not when an autocommand or
|
||||
* modeline has changed the value. */
|
||||
|
Reference in New Issue
Block a user