patch 9.1.2144: garbage collection may invalidate the recorded buffer changes

Commit: 
https://github.com/vim/vim/commit/55c12373f073bacfc97d757e8f4da3daf472e4ac
Author: Paul Ollis <[email protected]>
Date:   Mon Feb 9 19:30:14 2026 +0000

    patch 9.1.2144: garbage collection may invalidate the recorded buffer 
changes
    
    Problem:  When garbage collection runs, the list of recorded buffer
              changes may be incorrectly freed (Sainnhe Park).
    Solution: In garbage_collect(), iterate through all buffers and call
              set_ref_in_list() for b_recorded_changes to ensure the list
              and its contents are marked as reachable (Paul Ollis).
    
    fixes:  #19300
    closes: #19375
    
    Signed-off-by: Paul Ollis <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index 462a04848..880ea1f70 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -52542,4 +52542,11 @@ Problem:  When a popup window partially overlaps a 
wide character
 Solution: When a wide character is partially blocked by a popup, clear both
           cells in the screen buffer to prevent garbage (Yasuhiro Matsumoto).
 
+Patch 9.1.2144
+Problem:  When garbage collection runs, the list of recorded buffer
+         changes may be incorrectly freed (Sainnhe Park). 
+Solution: In garbage_collect(), iterate through all buffers and call
+          set_ref_in_list() for b_recorded_changes to ensure the list
+          and its contents are marked as reachable (Paul Ollis).
+
  vim:tw=78:ts=8:noet:ft=help:norl:fdm=manual:nofoldenable
diff --git a/src/gc.c b/src/gc.c
index d1f53991a..f15d1dffe 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -121,8 +121,11 @@ garbage_collect(int testing)
 
     // buffer-local variables
     FOR_ALL_BUFFERS(buf)
+    {
        abort = abort || set_ref_in_item(&buf->b_bufvar.di_tv, copyID,
                                                        NULL, NULL, NULL);
+       abort = abort || set_ref_in_list(buf->b_recorded_changes, copyID);
+    }
 
     // window-local variables
     FOR_ALL_TAB_WINDOWS(tp, wp)
diff --git a/src/version.c b/src/version.c
index 24f3ea3ce..f677f448a 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 */
+/**/
+    2144,
 /**/
     2143,
 /**/

-- 
-- 
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/E1vpXBv-003yBG-SQ%40256bit.org.

Raspunde prin e-mail lui