Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(threads): Always stop the camera device thread
Browse files Browse the repository at this point in the history
  • Loading branch information
yurivict committed Sep 27, 2017
1 parent f790747 commit 8522141
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/video/camerasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ CameraSource::~CameraSource()
QWriteLocker locker{&streamMutex};
QWriteLocker locker2{&deviceMutex};

// Stop the device thread
deviceThread->exit(0);
deviceThread->wait();
delete deviceThread;

if (_isNone) {
return;
}
Expand Down Expand Up @@ -223,10 +228,6 @@ CameraSource::~CameraSource()
// Synchronize with our stream thread
while (streamFuture.isRunning())
QThread::yieldCurrentThread();

deviceThread->exit(0);
deviceThread->wait();
delete deviceThread;
}

void CameraSource::subscribe()
Expand Down

0 comments on commit 8522141

Please sign in to comment.