diff --git a/app/render/previewautocacher.cpp b/app/render/previewautocacher.cpp index eed338fe9..8f7f5f8fa 100644 --- a/app/render/previewautocacher.cpp +++ b/app/render/previewautocacher.cpp @@ -282,7 +282,8 @@ bool PreviewAutoCacher::HasActiveJobs() const { return !hash_tasks_.isEmpty() || !audio_tasks_.isEmpty() - || !video_tasks_.isEmpty(); + || !video_tasks_.isEmpty() + || !single_frame_tasks_.isEmpty(); } void PreviewAutoCacher::AddNode(Node *node) @@ -377,16 +378,22 @@ void PreviewAutoCacher::ClearHashQueue(bool wait) void PreviewAutoCacher::ClearVideoQueue(bool wait) { // Copy because tasks that cancel immediately will be automatically removed from the list - auto copy = video_tasks_; + auto vt_copy = video_tasks_; + auto sft_copy = single_frame_tasks_; - for (auto it=copy.cbegin(); it!=copy.cend(); it++) { + for (auto it=vt_copy.cbegin(); it!=vt_copy.cend(); it++) { it.key()->Cancel(); } + foreach (RenderTicketWatcher* watcher, sft_copy) { + watcher->Cancel(); + } if (wait) { - copy = video_tasks_; - for (auto it=copy.cbegin(); it!=copy.cend(); it++) { + for (auto it=vt_copy.cbegin(); it!=vt_copy.cend(); it++) { it.key()->WaitForFinished(); } + foreach (RenderTicketWatcher* watcher, sft_copy) { + watcher->WaitForFinished(); + } } has_changed_ = true; @@ -606,13 +613,6 @@ void PreviewAutoCacher::SetViewerNode(Sequence *viewer_node) // be in the cache for later use. ClearVideoDownloadQueue(true); - // Wait for any single frame renders to finish - foreach (RenderTicketWatcher* watcher, single_frame_tasks_) { - watcher->Cancel(); - watcher->WaitForFinished(); - } - single_frame_tasks_.clear(); - // Clear any single frame render that might be queued single_frame_render_ = nullptr;