Fix SIGSEGV encountered on macOS

When attempting to close the frame grabber from a separate thread,
the application would crash due to a SIGSEGV.
This commit is contained in:
Devin Bileck 2024-03-26 22:59:57 -07:00
parent e6e9608473
commit 5f3f692b2f
No known key found for this signature in database
GPG key ID: 649D9C87FB168B88

View file

@ -120,6 +120,11 @@ public class ImageCaptureReader<T> extends Thread implements AutoCloseable {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
try {
frameGrabber.close();
} catch (FrameGrabber.Exception ignored) {
// Don't care if this throws an exception at this point
}
close();
}
}
@ -127,10 +132,5 @@ public class ImageCaptureReader<T> extends Thread implements AutoCloseable {
@Override
public void close() {
isRunning = false;
try {
frameGrabber.close();
} catch (FrameGrabber.Exception ignored) {
// Don't care if this throws an exception at this point
}
}
}