Commit graph

2 commits

Author SHA1 Message Date
Daisuke Maki 886f02bdee fix data race in Source.linesInRange under in-place compaction
In-place compaction in Append overwrites and then clears positions in the
backing array. linesInRange returned a slice aliased into that array and
released the read lock before the caller iterated it, so a concurrent
compaction could nil out the caller's view (panic on DisplayString()) and
trip the race detector. Return a copy.

Add a -race regression test that pins the contract.
2026-06-04 10:14:55 +09:00
Daisuke Maki ac77b9f2ff amortize capped Source.Append to O(1) 2026-06-04 07:54:04 +09:00