mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Fix warnings: search.c: find_pattern_in_path(): Np dereference: MI.
Problem : Dereference of null pointer @ 4395. Diagnostic : Multithreading issue. Rationale : Problem occurs only if global g_do_tagpreview changed while funcion is executing. Resolution : Use local copy of global var.
This commit is contained in:
parent
78b49ce950
commit
b02905bdd7
@ -3973,6 +3973,7 @@ find_pattern_in_path (
|
|||||||
char_u *startp = NULL;
|
char_u *startp = NULL;
|
||||||
char_u *inc_opt = NULL;
|
char_u *inc_opt = NULL;
|
||||||
win_T *curwin_save = NULL;
|
win_T *curwin_save = NULL;
|
||||||
|
const int l_g_do_tagpreview = g_do_tagpreview;
|
||||||
|
|
||||||
regmatch.regprog = NULL;
|
regmatch.regprog = NULL;
|
||||||
incl_regmatch.regprog = NULL;
|
incl_regmatch.regprog = NULL;
|
||||||
@ -4370,7 +4371,7 @@ search_line:
|
|||||||
} else if (--count <= 0) {
|
} else if (--count <= 0) {
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
if (depth == -1 && lnum == curwin->w_cursor.lnum
|
if (depth == -1 && lnum == curwin->w_cursor.lnum
|
||||||
&& g_do_tagpreview == 0
|
&& l_g_do_tagpreview == 0
|
||||||
)
|
)
|
||||||
EMSG(_("E387: Match is on current line"));
|
EMSG(_("E387: Match is on current line"));
|
||||||
else if (action == ACTION_SHOW) {
|
else if (action == ACTION_SHOW) {
|
||||||
@ -4380,7 +4381,7 @@ search_line:
|
|||||||
did_show = TRUE;
|
did_show = TRUE;
|
||||||
} else {
|
} else {
|
||||||
/* ":psearch" uses the preview window */
|
/* ":psearch" uses the preview window */
|
||||||
if (g_do_tagpreview != 0) {
|
if (l_g_do_tagpreview != 0) {
|
||||||
curwin_save = curwin;
|
curwin_save = curwin;
|
||||||
prepare_tagpreview(true);
|
prepare_tagpreview(true);
|
||||||
}
|
}
|
||||||
@ -4391,7 +4392,7 @@ search_line:
|
|||||||
}
|
}
|
||||||
if (depth == -1) {
|
if (depth == -1) {
|
||||||
/* match in current file */
|
/* match in current file */
|
||||||
if (g_do_tagpreview != 0) {
|
if (l_g_do_tagpreview != 0) {
|
||||||
if (getfile(0, curwin_save->w_buffer->b_fname,
|
if (getfile(0, curwin_save->w_buffer->b_fname,
|
||||||
NULL, TRUE, lnum, FALSE) > 0)
|
NULL, TRUE, lnum, FALSE) > 0)
|
||||||
break; /* failed to jump to file */
|
break; /* failed to jump to file */
|
||||||
@ -4412,7 +4413,7 @@ search_line:
|
|||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_do_tagpreview != 0
|
if (l_g_do_tagpreview != 0
|
||||||
&& curwin != curwin_save && win_valid(curwin_save)) {
|
&& curwin != curwin_save && win_valid(curwin_save)) {
|
||||||
/* Return cursor to where we were */
|
/* Return cursor to where we were */
|
||||||
validate_cursor();
|
validate_cursor();
|
||||||
|
Loading…
Reference in New Issue
Block a user