added lock

This commit is contained in:
Jared Bruni
2020-05-19 01:52:57 -07:00
parent 66dce1a193
commit d5a67ae67c
2 changed files with 6 additions and 3 deletions

View File

@@ -1400,8 +1400,10 @@ void AC_MainWindow::setFrameIndex(int index) {
frame_index = index; frame_index = index;
} }
std::mutex mut_lock;
void AC_MainWindow::updateFrame(QImage img) { void AC_MainWindow::updateFrame(QImage img) {
mut_lock.lock();
if(playback->isStopped() == false) { if(playback->isStopped() == false) {
disp->displayImage(img); disp->displayImage(img);
//disp2->displayImage(img); //disp2->displayImage(img);
@@ -1445,6 +1447,7 @@ void AC_MainWindow::updateFrame(QImage img) {
take_snapshot = false; take_snapshot = false;
} }
} }
mut_lock.unlock();
} }
void AC_MainWindow::stopRecording() { void AC_MainWindow::stopRecording() {

View File

@@ -345,7 +345,7 @@ void Playback::run() {
ac::in_custom = false; ac::in_custom = false;
drawFilter(frame, current_filter); drawFilter(frame, current_filter);
drawEffects(frame); drawEffects(frame);
msleep(duration/2); msleep(duration);
mutex.unlock(); mutex.unlock();
} else if(cur.size()>0) { } else if(cur.size()>0) {
mutex.lock(); mutex.lock();
@@ -355,7 +355,7 @@ void Playback::run() {
if(i == cur.size()-1) if(i == cur.size()-1)
ac::in_custom = false; ac::in_custom = false;
drawFilter(frame, cur[i]); drawFilter(frame, cur[i]);
msleep(duration/2); msleep(duration);
} }
} else { } else {
if(_custom_cycle_index > static_cast<int>(cur.size()-1)) if(_custom_cycle_index > static_cast<int>(cur.size()-1))
@@ -363,7 +363,7 @@ void Playback::run() {
if(_custom_cycle_index >= 0 && _custom_cycle_index < static_cast<int>(cur.size())) { if(_custom_cycle_index >= 0 && _custom_cycle_index < static_cast<int>(cur.size())) {
drawFilter(frame, cur[_custom_cycle_index]); drawFilter(frame, cur[_custom_cycle_index]);
msleep(duration/2); msleep(duration);
} }
} }
drawEffects(frame); drawEffects(frame);