]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0213: Crash when using a partial or lambda as a clipboard provider v9.2.0213
authorShane Harper <shane@shaneharper.net>
Fri, 20 Mar 2026 22:26:59 +0000 (22:26 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 20 Mar 2026 22:26:59 +0000 (22:26 +0000)
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 <shane@shaneharper.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/clipboard.c
src/testdir/test_eval_stuff.vim
src/version.c

index e4650c1b7af78f2a23428b20abaa21f61bdb3ea7..7ed339689fa9eb97b5e845532098748b6e2b8d90 100644 (file)
@@ -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;
 }
index 3da9ee303e2f7d7c18c9fd25538d3d7789ef09f4..e43bd601bbcfe9ffc726b25e068f1d1842f8a0d4 100644 (file)
@@ -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
index 83c07847e0206ddece452129e6e8eb8043ec609c..42ebf261eb815c5dc5c0a920ae2a2054ca116b6c 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    213,
 /**/
     212,
 /**/