Monitor: Fix a crash when destroying a monitor (shutdown)

We have to make sure close_event_thread is joined before we destroy the thread object,
otherwise std::terminate will be called.
This commit is contained in:
Peter Keresztes Schmidt 2021-04-25 23:09:32 +02:00
parent df754f0085
commit 6d06eac55e
1 changed files with 3 additions and 0 deletions

View File

@ -3116,6 +3116,9 @@ int Monitor::PrimeCapture() {
int Monitor::PreCapture() const { return camera->PreCapture(); }
int Monitor::PostCapture() const { return camera->PostCapture(); }
int Monitor::Close() {
if (close_event_thread.joinable()) {
close_event_thread.join();
}
// Because the stream indexes may change we have to clear out the packetqueue
if (decoder) {
decoder->Stop();