[Bf-blender-cvs] [f4c8b4eb3e3] master: Fix threading conflict with movie cache line
Sergey Sharybin
noreply at git.blender.org
Fri Mar 11 12:34:46 CET 2022
Commit: f4c8b4eb3e309ebc043cd998faa6d8d2bada14ac
Author: Sergey Sharybin
Date: Fri Mar 11 12:32:30 2022 +0100
Branches: master
https://developer.blender.org/rBf4c8b4eb3e309ebc043cd998faa6d8d2bada14ac
Fix threading conflict with movie cache line
It was possible that a render thread will be freeing cache while the
interface is iterating over cache items to build cache line.
Found while looking into T94738. It might be a fix, but I am unable
to reproduce the original issue, so can not know for sure whether
there is something else going or or not.
===================================================================
M source/blender/blenkernel/intern/movieclip.c
M source/blender/editors/space_image/image_draw.c
===================================================================
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index a53714c8a98..c23110b4703 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -1609,8 +1609,10 @@ void BKE_movieclip_get_cache_segments(MovieClip *clip,
if (clip->cache) {
int proxy = rendersize_to_proxy(user, clip->flag);
+ BLI_thread_lock(LOCK_MOVIECLIP);
IMB_moviecache_get_cache_segments(
clip->cache->moviecache, proxy, user->render_flag, r_totseg, r_points);
+ BLI_thread_unlock(LOCK_MOVIECLIP);
}
}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index cc86852e0d1..342f2df0020 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -541,7 +541,10 @@ void draw_image_cache(const bContext *C, ARegion *region)
int num_segments = 0;
int *points = NULL;
+ BLI_mutex_lock(image->runtime.cache_mutex);
IMB_moviecache_get_cache_segments(image->cache, IMB_PROXY_NONE, 0, &num_segments, &points);
+ BLI_mutex_unlock(image->runtime.cache_mutex);
+
ED_region_cache_draw_cached_segments(
region, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset);
}
More information about the Bf-blender-cvs
mailing list