From 2fd657db5b2b34aab32cd26b2f65ef7c94f0104a Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 2 Dec 2021 16:34:16 +0100 Subject: Fix T93560: crash with image paint undo and cycles preview render Cycles preview rendering could free the image buffers being used by drawing in another thread due to a race condition. This race condition was unlikely before, but now that preview renders are started right before we draw the image in the image editor or load it as a texture in the 3D viewport, it's likely to happen. As we are close to release this is too risky to fix properly, just avoid freeing the cache for preview renders instead and accept increased memory usage in some cases. --- intern/cycles/blender/shader.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'intern/cycles/blender/shader.cpp') diff --git a/intern/cycles/blender/shader.cpp b/intern/cycles/blender/shader.cpp index 0cd9052b47a..0f17834906d 100644 --- a/intern/cycles/blender/shader.cpp +++ b/intern/cycles/blender/shader.cpp @@ -762,7 +762,8 @@ static ShaderNode *add_node(Scene *scene, int scene_frame = b_scene.frame_current(); int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame); image->handle = scene->image_manager->add_image( - new BlenderImageLoader(b_image, image_frame), image->image_params()); + new BlenderImageLoader(b_image, image_frame, b_engine.is_preview()), + image->image_params()); } else { ustring filename = ustring( @@ -797,8 +798,9 @@ static ShaderNode *add_node(Scene *scene, if (is_builtin) { int scene_frame = b_scene.frame_current(); int image_frame = image_user_frame_number(b_image_user, b_image, scene_frame); - env->handle = scene->image_manager->add_image(new BlenderImageLoader(b_image, image_frame), - env->image_params()); + env->handle = scene->image_manager->add_image( + new BlenderImageLoader(b_image, image_frame, b_engine.is_preview()), + env->image_params()); } else { env->set_filename( -- cgit v1.2.3