Fix T75495: Blender crashes opening a VSE .blend file

During scene copy modifier mask strips are relinked to point to strips in
new scene. If strip used as mask is in different seqbase, this can fail,
if seqbase is not copied yet.

Add SEQ_DUPE_IS_RECURSIVE_CALL flag to avoid relinking modifiers during recursive call.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7412
This commit is contained in:
Richard Antalik 2020-04-26 23:35:56 +02:00
parent 05b94c9c54
commit dea1c1b9eb
Notes: blender-bot 2023-02-14 11:24:03 +01:00
Referenced by issue #75495, Blender crashes opening a VSE .blend file having certain meta strips
2 changed files with 8 additions and 1 deletions

View File

@ -496,6 +496,7 @@ typedef struct SeqLoadInfo {
#define SEQ_DUPE_CONTEXT (1 << 1)
#define SEQ_DUPE_ANIM (1 << 2)
#define SEQ_DUPE_ALL (1 << 3) /* otherwise only selected are copied */
#define SEQ_DUPE_IS_RECURSIVE_CALL (1 << 4)
/* use as an api function */
typedef struct Sequence *(*SeqLoadFn)(struct bContext *, ListBase *, struct SeqLoadInfo *);

View File

@ -5818,7 +5818,7 @@ void BKE_sequence_base_dupli_recursive(const Scene *scene_src,
Sequence *seqn = NULL;
Sequence *last_seq = BKE_sequencer_active_get((Scene *)scene_src);
/* always include meta's strips */
int dupe_flag_recursive = dupe_flag | SEQ_DUPE_ALL;
int dupe_flag_recursive = dupe_flag | SEQ_DUPE_ALL | SEQ_DUPE_IS_RECURSIVE_CALL;
for (seq = seqbase->first; seq; seq = seq->next) {
seq->tmp = NULL;
@ -5844,6 +5844,12 @@ void BKE_sequence_base_dupli_recursive(const Scene *scene_src,
}
}
/* Fix modifier links recursively from the top level only, when all sequences have been
* copied. */
if (dupe_flag & SEQ_DUPE_IS_RECURSIVE_CALL) {
return;
}
/* fix modifier linking */
for (seq = nseqbase->first; seq; seq = seq->next) {
seq_new_fix_links_recursive(seq);