Skip to content
Snippets Groups Projects
Commit 7bd9d6bc authored by d.kilic's avatar d.kilic
Browse files

Merge branch '149-crash-when-holding-next-frame-button-down-too-long' into 'master'

fix: Crash when holding frame-forward button too long

Closes #149

See merge request !105
parents 729c6c0a d2f81174
No related branches found
No related tags found
1 merge request!105fix: Crash when holding frame-forward button too long
Pipeline #38163 passed
......@@ -117,7 +117,7 @@ endif ()
# Qt
find_package(
Qt5 5.14
COMPONENTS Widgets OpenGL Xml Core PrintSupport
COMPONENTS Widgets OpenGL Xml Core PrintSupport Concurrent
REQUIRED)
# OpenCV
......@@ -169,6 +169,7 @@ target_link_libraries(petrack_core PUBLIC
Qt5::Xml
Qt5::Core
Qt5::PrintSupport
Qt5::Concurrent
)
target_include_directories(petrack_core PRIVATE "${CMAKE_SOURCE_DIR}/ui")
......
......@@ -27,6 +27,7 @@
#include <QLineEdit>
#include <QLabel>
#include <QIntValidator>
#include <QtConcurrent>
#include "player.h"
#include "animation.h"
......@@ -256,7 +257,10 @@ bool Player::updateImage()
double time1 = 0.0, tstart;
tstart = clock();
#endif
mMainWindow->updateImage(mImg);
QFuture<void> future = QtConcurrent::run([&]() {mMainWindow->updateImage(mImg); });
future.waitForFinished();
if (mRec)
{
mAviFile.appendFrame((const unsigned char*) mImg.data, true);
......@@ -271,7 +275,6 @@ bool Player::updateImage()
mSlider->setValue(mAnimation->getCurrentFrameNum()); //(1000*mAnimation->getCurrentFrameNum())/mAnimation->getNumFrames());
mFrameNum->setText(QString().number(mAnimation->getCurrentFrameNum()));
mSliderSet = false; // reset setSlider here because if value doesnt change than it would not be reset by skiptoframe
qApp->processEvents(); // to allow event while playing
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment