patch 9.2.0213: Crash when using a partial or lambda as a clipboard provider

Commit: 
https://github.com/vim/vim/commit/b1a247d659f4e1049771f2735bc0b0a36cb19323
Author: Shane Harper <[email protected]>
Date:   Fri Mar 20 22:26:59 2026 +0000

    patch 9.2.0213: Crash when using a partial or lambda as a clipboard provider
    
    Problem:  Crash when using a partial or lambda as a clipboard provider
    Solution: Don't call free_callback() from clip_provider_get_callback()
              (Shane Harper).
    
    closes: #19766
    
    Signed-off-by: Shane Harper <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/clipboard.c b/src/clipboard.c
index e4650c1b7..7ed339689 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -3778,7 +3778,8 @@ clip_provider_get_callback(
 
     // func_tv owns the function name, so we must make a copy for the callback
     set_callback(callback, &cb);
-    free_callback(&cb);
+    if (cb.cb_free_name)
+       vim_free(cb.cb_name);
     clear_tv(&func_tv);
     return OK;
 }
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index 3da9ee303..e43bd601b 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -866,10 +866,14 @@ endfunc
 func Test_clipboard_provider_copy()
   CheckFeature clipboard_provider
 
+  function s:copy_cb_to_test_partial(_, reg, type, str)
+    call s:Copy(a:reg, a:type, a:str)
+  endfunction
+
   let v:clipproviders["test"] = {
         \ "copy": {
         \       '+': function("s:Copy"),
-        \       '*': function("s:Copy")
+        \       '*': function("s:copy_cb_to_test_partial", [""])
         \   }
         \ }
   set clipmethod=test
diff --git a/src/version.c b/src/version.c
index 83c07847e..42ebf261e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    213,
 /**/
     212,
 /**/

-- 
-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1w3iaV-00FOeF-KG%40256bit.org.

Raspunde prin e-mail lui