From 632ef5b495fa3c4731c06683f062703365146b52 Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Fri, 3 Jul 2026 13:54:56 +0800 Subject: [PATCH] Invalidate cache before cancelling tasks on LUT change Reversing the order ensures that any render tasks that finish after the cancel request will find the cache already invalidated, preventing stale LUT-processed frames from being written back and shown in the viewer. --- app/node/color/ociolut/ociolut.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/node/color/ociolut/ociolut.cpp b/app/node/color/ociolut/ociolut.cpp index d56cc5a96..3ad968d25 100644 --- a/app/node/color/ociolut/ociolut.cpp +++ b/app/node/color/ociolut/ociolut.cpp @@ -185,16 +185,17 @@ void OCIOLutNode::GenerateProcessor() set_processor(processor); // The processor has changed. In the main GUI process (QApplication), refresh - // the viewer by cancelling background cache jobs and invalidating the cache. - // The worker process uses QGuiApplication and has no RenderManager/Preview - // AutoCacher, so skip this step to avoid crashing. + // the viewer by invalidating the cache and cancelling background cache jobs. + // Invalidating first ensures any in-flight renders that complete afterwards + // won't write stale frames back. The worker process uses QGuiApplication and + // has no RenderManager/PreviewAutoCacher, so skip this step to avoid crashing. if (qobject_cast(QCoreApplication::instance())) { + InvalidateAll(kTextureInput); if (RenderManager *rm = RenderManager::instance()) { if (PreviewAutoCacher *cacher = rm->GetCacher()) { cacher->CancelVideoTasks(false); } } - InvalidateAll(kTextureInput); } }