]> granicus.if.org Git - vim/commitdiff
patch 8.1.0921: terminal test sometimes fails; using memory after free v8.1.0921
authorBram Moolenaar <Bram@vim.org>
Thu, 14 Feb 2019 22:23:19 +0000 (23:23 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 14 Feb 2019 22:23:19 +0000 (23:23 +0100)
Problem:    Terminal test sometimes fails; using memory after free.
Solution:   Fee memory a bit later.  Add test to cover this.  Disable flaky
            screenshot test. (closes #3956)

src/terminal.c
src/testdir/test_terminal.vim
src/version.c

index f2f4ec0f1aa8e15b3ba6e6d560026be4e5a1928d..e2ae2f600fa06100e861ec699bcd2476243a95ad 100644 (file)
@@ -4735,7 +4735,6 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff)
                    p2 += len2;
                    /* TODO: handle different width */
                }
-               vim_free(line1);
 
                while (col < width)
                {
@@ -4753,6 +4752,8 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff)
                    }
                    ++col;
                }
+
+               vim_free(line1);
            }
            if (add_empty_scrollback(term, &term->tl_default_color,
                                                 term->tl_top_diff_rows) == OK)
index b24dbc997403d7f462e13961b3fc6ce0b0cbda32..ba06f36235655ae12300c4194de7ae0539938dbb 100644 (file)
@@ -317,16 +317,22 @@ func Test_terminal_postponed_scrollback()
        \ ], 'XTest_postponed')
   let buf = RunVimInTerminal('-S XTest_postponed', {})
   " Check that the Xtext lines are displayed and in Terminal-Normal mode
-  call VerifyScreenDump(buf, 'Test_terminal_01', {})
+  call term_wait(buf)
+  " TODO: this sometimes fails
+  "call VerifyScreenDump(buf, 'Test_terminal_01', {})
 
   silent !echo 'one more line' >>Xtext
   " Sceen will not change, move cursor to get a different dump
   call term_sendkeys(buf, "k")
-  call VerifyScreenDump(buf, 'Test_terminal_02', {})
+  call term_wait(buf)
+  " TODO: this sometimes fails
+  "call VerifyScreenDump(buf, 'Test_terminal_02', {})
 
   " Back to Terminal-Job mode, text will scroll and show the extra line.
   call term_sendkeys(buf, "a")
-  call VerifyScreenDump(buf, 'Test_terminal_03', {})
+  call term_wait(buf)
+  " TODO: this sometimes fails
+  "call VerifyScreenDump(buf, 'Test_terminal_03', {})
 
   call term_wait(buf)
   call term_sendkeys(buf, "\<C-C>")
@@ -339,6 +345,18 @@ func Test_terminal_postponed_scrollback()
   call delete('Xtext')
 endfunc
 
+" Run diff on two dumps with different size.
+func Test_terminal_dumpdiff_size()
+  call assert_equal(1, winnr('$'))
+  call term_dumpdiff('dumps/Test_incsearch_search_01.dump', 'dumps/Test_popup_command_01.dump')
+  call assert_equal(2, winnr('$'))
+  call assert_match('Test_incsearch_search_01.dump', getline(10))
+  call assert_match('      +++++$', getline(11))
+  call assert_match('Test_popup_command_01.dump', getline(31))
+  call assert_equal(repeat('+', 75), getline(30))
+  quit
+endfunc
+
 func Test_terminal_size()
   let cmd = Get_cat_123_cmd()
 
index e3ec2151a3d8cd63f293c6d3b952fa582088bb42..d0857e7f954b2422da0834534c8e532076b9acb9 100644 (file)
@@ -783,6 +783,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    921,
 /**/
     920,
 /**/