mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Refactor TryDisposeAll
This commit is contained in:
parent
5fa05fa0d1
commit
d7012b068f
@ -87,11 +87,7 @@ namespace Remotely.Desktop.Core.Services
|
||||
public void Dispose()
|
||||
{
|
||||
DisconnectRequested = true;
|
||||
Disposer.TryDisposeAll(new IDisposable[]
|
||||
{
|
||||
RtcSession,
|
||||
Capturer
|
||||
});
|
||||
Disposer.TryDisposeAll(RtcSession, Capturer);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
|
||||
@ -61,12 +61,7 @@ namespace Remotely.Desktop.Core.Services
|
||||
}
|
||||
catch { }
|
||||
PeerSession.Transceivers.RemoveAll(x => true);
|
||||
Disposer.TryDisposeAll(new IDisposable[]
|
||||
{
|
||||
Transceiver?.LocalVideoTrack,
|
||||
VideoSource,
|
||||
PeerSession
|
||||
});
|
||||
Disposer.TryDisposeAll(Transceiver?.LocalVideoTrack, VideoSource, PeerSession);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
|
||||
@ -25,13 +25,7 @@ namespace Remotely.Desktop.Win.Models
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Disposer.TryDisposeAll(new IDisposable[]
|
||||
{
|
||||
Adapter,
|
||||
Device,
|
||||
OutputDuplication,
|
||||
Texture2D
|
||||
});
|
||||
Disposer.TryDisposeAll(Adapter, Device, OutputDuplication, Texture2D);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ namespace Remotely.Shared.Utilities
|
||||
{
|
||||
public static class Disposer
|
||||
{
|
||||
public static void TryDisposeAll(IDisposable[] disposables)
|
||||
public static void TryDisposeAll(params IDisposable[] disposables)
|
||||
{
|
||||
if (disposables is null)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user