From c688b038473a56e0ce69014fddc5700e46f162f4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne <bastien@blender.org> Date: Fri, 10 Nov 2023 14:29:44 +0100 Subject: [PATCH] Fix (studio-reported) VSE prefetch process taking seconds to stop. When VSE cache is invalidated (on most VSE edit operation e.g.), or Blender quits, in some cases (complex and very long edits), the prefetch job would block several seconds after being requested to stop. This was because one codepath would keep looping over all frames without checking for the `stop` flag. --- source/blender/sequencer/intern/prefetch.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/sequencer/intern/prefetch.cc b/source/blender/sequencer/intern/prefetch.cc index 7305123c640..d4aeb8912db 100644 --- a/source/blender/sequencer/intern/prefetch.cc +++ b/source/blender/sequencer/intern/prefetch.cc @@ -500,6 +500,10 @@ static void *seq_prefetch_frames(void *job) ListBase *channels = SEQ_channels_displayed_get(SEQ_editing_get(pfjob->scene_eval)); if (seq_prefetch_must_skip_frame(pfjob, channels, seqbase)) { pfjob->num_frames_prefetched++; + /* Break instead of keep looping if the job should be terminated. */ + if (!(pfjob->scene->ed->cache_flag & SEQ_CACHE_PREFETCH_ENABLE) || pfjob->stop) { + break; + } continue; } -- GitLab