Make sure to dispose some WeakRefs

This commit is contained in:
Alex Barney 2022-07-06 13:29:32 -07:00
parent 6b2ee7a54d
commit 99d497ca7c
2 changed files with 3 additions and 1 deletions

View file

@ -7,7 +7,6 @@ namespace LibHac.FsSrv.Impl;
public class DeepRetryFileSystem : ForwardingFileSystem public class DeepRetryFileSystem : ForwardingFileSystem
{ {
// ReSharper disable once NotAccessedField.Local
private WeakRef<DeepRetryFileSystem> _selfReference; private WeakRef<DeepRetryFileSystem> _selfReference;
private SharedRef<IRomFileSystemAccessFailureManager> _accessFailureManager; private SharedRef<IRomFileSystemAccessFailureManager> _accessFailureManager;
@ -31,6 +30,8 @@ public class DeepRetryFileSystem : ForwardingFileSystem
public override void Dispose() public override void Dispose()
{ {
_accessFailureManager.Destroy(); _accessFailureManager.Destroy();
_selfReference.Destroy();
base.Dispose(); base.Dispose();
} }

View file

@ -290,6 +290,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
public void Dispose() public void Dispose()
{ {
_baseFileSystem.Destroy(); _baseFileSystem.Destroy();
_selfReference.Destroy();
} }
private static ReadOnlySpan<byte> RootDir => "/"u8; private static ReadOnlySpan<byte> RootDir => "/"u8;