[Bf-blender-cvs] [0ba0d27d368] blender-v2.93-release: Fix T87090: VSE scrubbing locks up blender

Richard Antalik noreply at git.blender.org
Thu Apr 22 14:26:05 CEST 2021


Commit: 0ba0d27d368422b29db42c09f0ef658ce5b1e604
Author: Richard Antalik
Date:   Thu Apr 22 14:09:33 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB0ba0d27d368422b29db42c09f0ef658ce5b1e604

Fix T87090: VSE scrubbing locks up blender

Speed effect caused, that some raw frames are re-used for multiple
final frames. When cached final frame is freed due to memory being
full, it tried to free also lower level cached frames that were used
during compositing. Some lower level cached frames were already freed
by different final frame and `BLI_ghash_remove()` failed.

Check if key still exists in hash or if linked keys were overwritten
before removing them.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10909

===================================================================

M	source/blender/sequencer/intern/image_cache.c

===================================================================

diff --git a/source/blender/sequencer/intern/image_cache.c b/source/blender/sequencer/intern/image_cache.c
index 290ee185865..089bb5a6bec 100644
--- a/source/blender/sequencer/intern/image_cache.c
+++ b/source/blender/sequencer/intern/image_cache.c
@@ -976,14 +976,34 @@ static void seq_cache_recycle_linked(Scene *scene, SeqCacheKey *base)
   SeqCacheKey *next = base->link_next;
 
   while (base) {
+    if (!BLI_ghash_haskey(cache->hash, base)) {
+      break; /* Key has already been removed from cache. */
+    }
+
     SeqCacheKey *prev = base->link_prev;
+    if (prev != NULL && prev->link_next != base) {
+      /* Key has been removed and replaced and doesn't belong to this chain anymore. */
+      base->link_prev = NULL;
+      break;
+    }
+
     BLI_ghash_remove(cache->hash, base, seq_cache_keyfree, seq_cache_valfree);
     base = prev;
   }
 
   base = next;
   while (base) {
+    if (!BLI_ghash_haskey(cache->hash, base)) {
+      break; /* Key has already been removed from cache. */
+    }
+
     next = base->link_next;
+    if (next != NULL && next->link_prev != base) {
+      /* Key has been removed and replaced and doesn't belong to this chain anymore. */
+      base->link_next = NULL;
+      break;
+    }
+
     BLI_ghash_remove(cache->hash, base, seq_cache_keyfree, seq_cache_valfree);
     base = next;
   }



More information about the Bf-blender-cvs mailing list