mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 07:44:09 +02:00
properly reset internal state on close
This commit is contained in:
parent
4211c267a6
commit
98da39a3ba
2 changed files with 10 additions and 5 deletions
|
@ -179,7 +179,12 @@ namespace System.IO
|
|||
|
||||
public override Result<void> Close()
|
||||
{
|
||||
return Flush();
|
||||
let ret = Flush();
|
||||
|
||||
mPos = 0;
|
||||
mBufferPos = -Int32.MinValue;
|
||||
mBufferEnd = -Int32.MinValue;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -371,14 +371,14 @@ namespace System.IO
|
|||
|
||||
public override Result<void> Close()
|
||||
{
|
||||
var hadError = Flush() case .Err;
|
||||
let ret = base.Close();
|
||||
if (mBfpFile != null)
|
||||
Platform.BfpFile_Release(mBfpFile);
|
||||
|
||||
mBfpFile = null;
|
||||
mFileAccess = default;
|
||||
if (hadError)
|
||||
return .Err;
|
||||
return .Ok;
|
||||
mBfpFilePos = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected override void UpdateLength()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue