From 3f420ce0d829a8cdff9d55f6178989ca8e0406c9 Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Fri, 14 Nov 2014 21:26:24 +0100 Subject: 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. --- src/nvim/tag.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 816e9902fe..724261f08e 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -2308,6 +2308,7 @@ jumpto_tag ( win_T *curwin_save = NULL; char_u *full_fname = NULL; int old_KeyTyped = KeyTyped; /* getting the file may reset it */ + const int l_g_do_tagpreview = g_do_tagpreview; pbuf = xmalloc(LSIZE); @@ -2364,7 +2365,7 @@ jumpto_tag ( ++RedrawingDisabled; - if (g_do_tagpreview != 0) { + if (l_g_do_tagpreview != 0) { postponed_split = 0; /* don't split again below */ curwin_save = curwin; /* Save current window */ @@ -2396,7 +2397,7 @@ jumpto_tag ( if (keep_help) { /* 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. */ - if (g_do_tagpreview != 0) + if (l_g_do_tagpreview != 0) keep_help_flag = curwin_save->w_buffer->b_help; else keep_help_flag = curbuf->b_help; @@ -2542,7 +2543,7 @@ jumpto_tag ( foldOpenCursor(); } - if (g_do_tagpreview != 0 + if (l_g_do_tagpreview != 0 && curwin != curwin_save && win_valid(curwin_save)) { /* Return cursor to where we were */ validate_cursor(); -- cgit