fix(compresssave): wait for async worker before closing save

This commit is contained in:
2026-08-05 03:30:38 +08:00
parent 732aceae4e
commit 009773f06b
5 changed files with 421 additions and 20 deletions
+4 -2
View File
@@ -20,6 +20,7 @@ public unsafe class BufferWriter : BinaryWriter
private long SuplusCapacity => _endPos - _curPos;
private long _swapedBytes;
private bool _closed;
public long WriteSum => _swapedBytes + _curPos - _startPos;
@@ -91,8 +92,9 @@ public unsafe class BufferWriter : BinaryWriter
protected override void Dispose(bool disposing)
{
if (disposing)
if (disposing && !_closed)
{
_closed = true;
SwapBuffer();
}
base.Dispose(disposing);
@@ -288,4 +290,4 @@ public unsafe class BufferWriter : BinaryWriter
}
Write((byte)num);
}
}
}