patch 9.1.1411: crash when calling non-existing function for tabpanel

Commit: 
https://github.com/vim/vim/commit/a88c5bdcce2a3b603018149f02af94e392d2924f
Author: Christian Brabandt <c...@256bit.org>
Date:   Mon May 26 19:51:03 2025 +0200

    patch 9.1.1411: crash when calling non-existing function for tabpanel
    
    Problem:  crash when calling non-existing function for tabpanel (Yamagi,
              after v9.1.1391)
    Solution: check if there was an error and if there was, set tabpanel
              option to empty to prevent showing errors on every redraw
    
    fixes: #17364
    closes: #17375
    closes: #17371
    
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/tabpanel.c b/src/tabpanel.c
index 81e2c0c07..bb7a8742b 100644
--- a/src/tabpanel.c
+++ b/src/tabpanel.c
@@ -496,6 +496,7 @@ starts_with_percent_and_bang(tabpanel_T *pargs)
 {
     int                len = 0;
     char_u     *usefmt = p_tpl;
+    int                did_emsg_before = did_emsg;
 
     if (usefmt == NULL)
        return NULL;
@@ -525,6 +526,13 @@ starts_with_percent_and_bang(tabpanel_T *pargs)
            usefmt = p;
 
        do_unlet((char_u *)"g:tabpanel_winid", TRUE);
+
+       if (did_emsg > did_emsg_before)
+       {
+           usefmt = NULL;
+           set_string_option_direct((char_u *)"tabpanel", -1, (char_u *)"",
+                   OPT_FREE | OPT_GLOBAL, SID_ERROR);
+       }
     }
 #endif
 
diff --git a/src/testdir/test_tabpanel.vim b/src/testdir/test_tabpanel.vim
index c67166e1c..6aaae63ac 100644
--- a/src/testdir/test_tabpanel.vim
+++ b/src/testdir/test_tabpanel.vim
@@ -521,4 +521,16 @@ function Test_tabpanel_equalalways()
   call StopVimInTerminal(buf)
 endfunc
 
+function Test_tabpanel_error()
+  set tabpanel=%!NonExistingFunc()
+  try
+    set showtabpanel=2
+    redraw!
+  catch /^Vim\%(( \+)\)\=:E117:/
+  endtry
+  call assert_true(empty(&tabpanel))
+  set tabpanel&vim
+  set showtabpanel&vim
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 33b08bb3a..67ac9fbfc 100644
--- a/src/version.c
+++ b/src/version.c
@@ -709,6 +709,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1411,
 /**/
     1410,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uJc7K-00H4QG-Ik%40256bit.org.

Raspunde prin e-mail lui