mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 15:08:35 +00:00
Fix warnings: tag.c: jumpto_tag(): Np dereference: MI.
Problem : Dereference of null pointer @ 2399. Diagnostic : Multithreading issue. Rationale : Error can only occur if global `g_do_tagpreview` changes while the function is executing. Resolution : Use local copy of global var.
This commit is contained in:
@@ -2308,6 +2308,7 @@ jumpto_tag (
|
|||||||
win_T *curwin_save = NULL;
|
win_T *curwin_save = NULL;
|
||||||
char_u *full_fname = NULL;
|
char_u *full_fname = NULL;
|
||||||
int old_KeyTyped = KeyTyped; /* getting the file may reset it */
|
int old_KeyTyped = KeyTyped; /* getting the file may reset it */
|
||||||
|
const int l_g_do_tagpreview = g_do_tagpreview;
|
||||||
|
|
||||||
pbuf = xmalloc(LSIZE);
|
pbuf = xmalloc(LSIZE);
|
||||||
|
|
||||||
@@ -2364,7 +2365,7 @@ jumpto_tag (
|
|||||||
++RedrawingDisabled;
|
++RedrawingDisabled;
|
||||||
|
|
||||||
|
|
||||||
if (g_do_tagpreview != 0) {
|
if (l_g_do_tagpreview != 0) {
|
||||||
postponed_split = 0; /* don't split again below */
|
postponed_split = 0; /* don't split again below */
|
||||||
curwin_save = curwin; /* Save current window */
|
curwin_save = curwin; /* Save current window */
|
||||||
|
|
||||||
@@ -2396,7 +2397,7 @@ jumpto_tag (
|
|||||||
if (keep_help) {
|
if (keep_help) {
|
||||||
/* A :ta from a help file will keep the b_help flag set. For ":ptag"
|
/* A :ta from a help file will keep the b_help flag set. For ":ptag"
|
||||||
* we need to use the flag from the window where we came from. */
|
* we need to use the flag from the window where we came from. */
|
||||||
if (g_do_tagpreview != 0)
|
if (l_g_do_tagpreview != 0)
|
||||||
keep_help_flag = curwin_save->w_buffer->b_help;
|
keep_help_flag = curwin_save->w_buffer->b_help;
|
||||||
else
|
else
|
||||||
keep_help_flag = curbuf->b_help;
|
keep_help_flag = curbuf->b_help;
|
||||||
@@ -2542,7 +2543,7 @@ jumpto_tag (
|
|||||||
foldOpenCursor();
|
foldOpenCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
Reference in New Issue
Block a user