[Bf-blender-cvs] [24a3446787d] master: Fix T90646: VSE hangs when strips overlap

Richard Antalik noreply at git.blender.org
Tue Aug 24 00:49:43 CEST 2021


Commit: 24a3446787d31f9b32e6759f91349b598c8e9774
Author: Richard Antalik
Date:   Tue Aug 24 00:46:34 2021 +0200
Branches: master
https://developer.blender.org/rB24a3446787d31f9b32e6759f91349b598c8e9774

Fix T90646: VSE hangs when strips overlap

When all strips are selected and overlap is caused, this causes VSE to
hang in infinite loop, because such situation should never happen.

To prevent infinite loop, ensure, that strip overlap is not tested
against single overlapping strip itself.

Prevent overlap that can not be handled because of issue described above
by moving overlapping strip between channels.

Reviewed By: campbellbarton

Differential Revision: D12209

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

M	source/blender/editors/transform/transform_convert_sequencer.c
M	source/blender/sequencer/CMakeLists.txt
M	source/blender/sequencer/SEQ_iterator.h
M	source/blender/sequencer/intern/iterator.c
M	source/blender/sequencer/intern/strip_transform.c

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

diff --git a/source/blender/editors/transform/transform_convert_sequencer.c b/source/blender/editors/transform/transform_convert_sequencer.c
index 17512c79d03..45ed0f3b664 100644
--- a/source/blender/editors/transform/transform_convert_sequencer.c
+++ b/source/blender/editors/transform/transform_convert_sequencer.c
@@ -400,15 +400,14 @@ static void seq_transform_handle_overlap(TransInfo *t, SeqCollection *transforme
   if (seq_transform_check_strip_effects(transformed_strips)) {
     /* Update effect strips based on strips just moved in time. */
     seq_transform_update_effects(t, transformed_strips);
+  }
 
-    /* If any effects still overlap, we need to move them up. */
-    Sequence *seq;
-    SEQ_ITERATOR_FOREACH (seq, transformed_strips) {
-      if ((seq->type & SEQ_TYPE_EFFECT) && seq->seq1) {
-        if (SEQ_transform_test_overlap(seqbasep, seq)) {
-          SEQ_transform_seqbase_shuffle(seqbasep, seq, t->scene);
-        }
-      }
+  /* If any effects still overlap, we need to move them up.
+   * In some cases other strips can be overlapping still, see T90646. */
+  Sequence *seq;
+  SEQ_ITERATOR_FOREACH (seq, transformed_strips) {
+    if (SEQ_transform_test_overlap(seqbasep, seq)) {
+      SEQ_transform_seqbase_shuffle(seqbasep, seq, t->scene);
     }
   }
 }
diff --git a/source/blender/sequencer/CMakeLists.txt b/source/blender/sequencer/CMakeLists.txt
index e324bc8b407..f060e6ad69b 100644
--- a/source/blender/sequencer/CMakeLists.txt
+++ b/source/blender/sequencer/CMakeLists.txt
@@ -33,6 +33,7 @@ set(INC
   ../render
   ../windowmanager
   ../../../intern/atomic
+  ../../../intern/clog
   ../../../intern/guardedalloc
 
   # dna_type_offsets.h
diff --git a/source/blender/sequencer/SEQ_iterator.h b/source/blender/sequencer/SEQ_iterator.h
index cb2091511a9..3ade7309f89 100644
--- a/source/blender/sequencer/SEQ_iterator.h
+++ b/source/blender/sequencer/SEQ_iterator.h
@@ -73,6 +73,7 @@ struct Sequence *SEQ_iterator_yield(SeqIterator *iterator);
 SeqCollection *SEQ_collection_create(const char *name);
 SeqCollection *SEQ_collection_duplicate(SeqCollection *collection);
 uint SEQ_collection_len(const SeqCollection *collection);
+bool SEQ_collection_has_strip(const struct Sequence *seq, const SeqCollection *collection);
 bool SEQ_collection_append_strip(struct Sequence *seq, SeqCollection *data);
 bool SEQ_collection_remove_strip(struct Sequence *seq, SeqCollection *data);
 void SEQ_collection_free(SeqCollection *collection);
diff --git a/source/blender/sequencer/intern/iterator.c b/source/blender/sequencer/intern/iterator.c
index 09f033e70fb..333a8e46c44 100644
--- a/source/blender/sequencer/intern/iterator.c
+++ b/source/blender/sequencer/intern/iterator.c
@@ -122,6 +122,14 @@ uint SEQ_collection_len(const SeqCollection *collection)
   return BLI_gset_len(collection->set);
 }
 
+/**
+ * Check if seq is in collection.
+ */
+bool SEQ_collection_has_strip(const Sequence *seq, const SeqCollection *collection)
+{
+  return BLI_gset_haskey(collection->set, seq);
+}
+
 /**
  * Query strips from seqbase. seq_reference is used by query function as filter condition.
  *
diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c
index c9af2fced65..9f69f434ca0 100644
--- a/source/blender/sequencer/intern/strip_transform.c
+++ b/source/blender/sequencer/intern/strip_transform.c
@@ -40,6 +40,10 @@
 #include "SEQ_time.h"
 #include "SEQ_transform.h"
 
+#include "CLG_log.h"
+
+static CLG_LogRef LOG = {"seq.strip_transform"};
+
 static int seq_tx_get_start(Sequence *seq)
 {
   return seq->start;
@@ -315,6 +319,12 @@ static int shuffle_seq_time_offset_test(SeqCollection *strips_to_shuffle,
       if (!seq_overlap(seq, seq_other)) {
         continue;
       }
+      if (UNLIKELY(SEQ_collection_has_strip(seq_other, strips_to_shuffle))) {
+        CLOG_WARN(&LOG,
+                  "Strip overlaps with itself or another strip, that is to be shuffled."
+                  "This should never happen.");
+        continue;
+      }
       if (dir == 'L') {
         offset = min_ii(offset, seq_other->startdisp - seq->enddisp);
       }



More information about the Bf-blender-cvs mailing list