File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
src/macro-external/opencv Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 4
4
#include " utility.hpp"
5
5
6
6
#include < screenshot-helper.hpp>
7
- #include < condition_variable>
8
7
9
8
PreviewDialog::PreviewDialog (QWidget *parent, int delay)
10
9
: QDialog(parent),
@@ -119,6 +118,7 @@ void PreviewDialog::SelectArea()
119
118
void PreviewDialog::Stop ()
120
119
{
121
120
_stop = true ;
121
+ _cv.notify_all ();
122
122
if (_thread.joinable ()) {
123
123
_thread.join ();
124
124
}
@@ -189,13 +189,12 @@ void PreviewDialog::Start()
189
189
190
190
void PreviewDialog::CheckForMatchLoop ()
191
191
{
192
- std::condition_variable cv;
193
192
while (!_stop) {
194
193
std::unique_lock<std::mutex> lock (_mtx);
195
194
auto source = obs_weak_source_get_source (_video.GetVideo ());
196
195
ScreenshotHelper screenshot (source);
197
196
obs_source_release (source);
198
- cv .wait_for (lock, std::chrono::milliseconds (_delay));
197
+ _cv .wait_for (lock, std::chrono::milliseconds (_delay));
199
198
if (_stop || isHidden ()) {
200
199
return ;
201
200
}
Original file line number Diff line number Diff line change 12
12
13
13
#include < thread>
14
14
#include < mutex>
15
+ #include < condition_variable>
15
16
16
17
class PreviewDialog : public QDialog {
17
18
Q_OBJECT
@@ -62,6 +63,7 @@ private slots:
62
63
std::atomic_bool _selectingArea = {false };
63
64
64
65
std::mutex _mtx;
66
+ std::condition_variable _cv;
65
67
std::thread _thread;
66
68
std::atomic_bool _stop = {true };
67
69
You can’t perform that action at this time.
0 commit comments