refactor: store-owned diff snapshot and drop dead ChunkJob.ExistingChunk
TryGetDiff now returns an independent copy so callers can safely retain the reference; removes the defensive copy from ChunkStreamer.DispatchLoad. ChunkJob.ExistingChunk was never populated (DispatchRemesh uses closures instead), so the field is removed along with its misleading record-level comment.
This commit is contained in:
@@ -10,7 +10,9 @@ public sealed class InMemoryChunkModificationStore : IChunkModificationStore
|
||||
{
|
||||
if (this._diffs.TryGetValue(chunkPos, out Dictionary<int, ushort>? d))
|
||||
{
|
||||
diff = d;
|
||||
// Returned snapshot: callers may safely retain and enumerate even
|
||||
// after concurrent RecordEdit on the same chunk.
|
||||
diff = new Dictionary<int, ushort>(d);
|
||||
return true;
|
||||
}
|
||||
diff = null;
|
||||
|
||||
Reference in New Issue
Block a user