]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0750: crash when popup closed in callback v9.0.0750
authorBram Moolenaar <Bram@vim.org>
Fri, 14 Oct 2022 16:04:09 +0000 (17:04 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 14 Oct 2022 16:04:09 +0000 (17:04 +0100)
Problem:    Crash when popup closed in callback. (Maxim Kim)
Solution:   In syntax_end_parsing() check that syn_block is valid.

src/drawscreen.c
src/proto/syntax.pro
src/syntax.c
src/version.c

index d55c2eaec42051962dedfaeb9f8d1a3dae839aa4..5a23d54fd62728cf1fe0cba699596b7db21ce8ba 100644 (file)
@@ -2486,7 +2486,7 @@ win_update(win_T *wp)
                // Let the syntax stuff know we skipped a few lines.
                if (syntax_last_parsed != 0 && syntax_last_parsed + 1 < lnum
                                                       && syntax_present(wp))
-                   syntax_end_parsing(syntax_last_parsed + 1);
+                   syntax_end_parsing(wp, syntax_last_parsed + 1);
 #endif
 
                // Display one line.
@@ -2601,7 +2601,7 @@ win_update(win_T *wp)
 #ifdef FEAT_SYN_HL
     // Let the syntax stuff know we stop parsing here.
     if (syntax_last_parsed != 0 && syntax_present(wp))
-       syntax_end_parsing(syntax_last_parsed + 1);
+       syntax_end_parsing(wp, syntax_last_parsed + 1);
 #endif
 
     // If we didn't hit the end of the file, and we didn't finish the last
index c06498c8750bb90a10e2cdfc251d0f2810cffd05..c51da7ab87f414478131cd6025acdbc296529e81 100644 (file)
@@ -2,7 +2,7 @@
 void syntax_start(win_T *wp, linenr_T lnum);
 void syn_stack_free_all(synblock_T *block);
 void syn_stack_apply_changes(buf_T *buf);
-void syntax_end_parsing(linenr_T lnum);
+void syntax_end_parsing(win_T *wp, linenr_T lnum);
 int syntax_check_changed(linenr_T lnum);
 int get_syntax_attr(colnr_T col, int *can_spell, int keep_state);
 void syntax_clear(synblock_T *block);
index ea8d541de075d3ca98d2d131ecea6213bf9b0f19..468dee09ab099ba9c7436679d2dc0f9454155c69 100644 (file)
@@ -1542,10 +1542,12 @@ syn_stack_equal(synstate_T *sp)
  * lnum ->  line below window
  */
     void
-syntax_end_parsing(linenr_T lnum)
+syntax_end_parsing(win_T *wp, linenr_T lnum)
 {
     synstate_T *sp;
 
+    if (syn_block != wp->w_s)
+       return;  // not the right window
     sp = syn_stack_find_entry(lnum);
     if (sp != NULL && sp->sst_lnum < lnum)
        sp = sp->sst_next;
index 708e762f7b2ca75f0356060e9b5f258633c5ee67..bd9915a80fd3fec81aec482f82807c52819fdb49 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    750,
 /**/
     749,
 /**/