diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-04-08 22:57:40 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-04-08 23:01:04 +0300 |
commit | c13aa95eda888c61514693c33ec506bf182257a1 (patch) | |
tree | 565a687aa02e46ab44f035fffa5f689505656c2d /intern/cycles | |
parent | cc53c9e4764fd938af3a486feb013026c134080f (diff) |
Fix T75288: crash in Cycles image loading with multithreaded shader compilation
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/render/image.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/render/image.h | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 67ed1176171..75050b66bf2 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -283,6 +283,7 @@ void ImageManager::set_osl_texture_system(void *texture_system) bool ImageManager::set_animation_frame_update(int frame) { if (frame != animation_frame) { + thread_scoped_lock device_lock(images_mutex); animation_frame = frame; for (size_t slot = 0; slot < images.size(); slot++) { @@ -377,7 +378,7 @@ int ImageManager::add_image_slot(ImageLoader *loader, Image *img; size_t slot; - thread_scoped_lock device_lock(device_mutex); + thread_scoped_lock device_lock(images_mutex); /* Fnd existing image. */ for (slot = 0; slot < images.size(); slot++) { @@ -418,6 +419,7 @@ int ImageManager::add_image_slot(ImageLoader *loader, void ImageManager::add_image_user(int slot) { + thread_scoped_lock device_lock(images_mutex); Image *image = images[slot]; assert(image && image->users >= 1); @@ -426,6 +428,7 @@ void ImageManager::add_image_user(int slot) void ImageManager::remove_image_user(int slot) { + thread_scoped_lock device_lock(images_mutex); Image *image = images[slot]; assert(image && image->users >= 1); diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index 00ab12afd7a..2000582ce70 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -206,6 +206,7 @@ class ImageManager { bool has_half_images; thread_mutex device_mutex; + thread_mutex images_mutex; int animation_frame; vector<Image *> images; |