Fix possible crash changing profile when cache job was running

parent 7536ab68
Pipeline #6240 passed with stage
in 20 minutes and 47 seconds
......@@ -82,7 +82,13 @@ bool CacheJob::startJob()
}
int size = frames.size();
int count = 0;
connect(this, &CacheJob::jobCanceled, [&] () {
m_done = true;
});
for (int i : frames) {
if (m_done) {
break;
}
emit jobProgress(100 * count / size);
count++;
if (ThumbnailCache::get()->hasThumbnail(m_binClip->clipId(), i)) {
......@@ -93,7 +99,7 @@ bool CacheJob::startJob()
frame->set("deinterlace_method", "onefield");
frame->set("top_field_first", -1);
frame->set("rescale.interp", "nearest");
if ((frame != nullptr) && frame->is_valid()) {
if (!m_done && (frame != nullptr) && frame->is_valid()) {
QImage result = KThumb::getFrame(frame.data());
ThumbnailCache::get()->storeThumbnail(m_binClip->clipId(), i, result, true);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment