fix: Fixes ValueStringBuilder dispose incorrectly (#1037)
This commit is contained in:
parent
3b7e3c2fb7
commit
1e6ab794fe
1 changed files with 4 additions and 4 deletions
|
|
@ -347,12 +347,12 @@ public ref struct ValueStringBuilder
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Dispose()
|
||||
{
|
||||
char[] toReturn = _arrayToReturnToPool;
|
||||
this = default; // for safety, to avoid using pooled array if this instance is erroneously appended to again
|
||||
if (toReturn != null)
|
||||
if (_arrayToReturnToPool != null)
|
||||
{
|
||||
ArrayPool.Return(toReturn);
|
||||
ArrayPool.Return(_arrayToReturnToPool);
|
||||
}
|
||||
|
||||
this = default; // for safety, to avoid using pooled array if this instance is erroneously appended to again
|
||||
}
|
||||
#nullable restore
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue