Skip to content

Commit ca3cef2

Browse files
committed
fix dispose
1 parent 1af8c15 commit ca3cef2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

FlashCap.Core/Devices/AVFoundationDevice.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ public AVFoundationDevice(string uniqueID, string modelID) :
4242

4343
protected override async Task OnDisposeAsync()
4444
{
45+
if (this.session != null)
46+
{
47+
this.session.StopRunning();
48+
this.session.Dispose();
49+
}
50+
4551
this.device?.Dispose();
4652
this.deviceInput?.Dispose();
4753
this.deviceOutput?.Dispose();
48-
this.session?.Dispose();
4954
this.queue?.Dispose();
5055

5156
Marshal.FreeHGlobal(this.bitmapHeader);

0 commit comments

Comments
 (0)