mirror of
https://github.com/soarqin/DSP_Mods_TO.git
synced 2026-08-07 09:10:10 +08:00
fix(compresssave): wait for async worker before closing save
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user