Fix T76033: VSE crash with prefetch, disk cache and meta strips
`BKE_sequencer_prefetch_get_original_sequence()` didn't look in metas and returned NULL. This caused crash in disk cache that was trying to read seq->name. Add function that will look in meta strips recursively and condition that seq must not be NULL. Reviewed By: brecht Maniphest Tasks: T76033 Differential Revision: https://developer.blender.org/D7597
This commit is contained in:
parent
b52b5e15af
commit
98990f6ba4
Notes:
blender-bot
2023-02-14 05:22:18 +01:00
Referenced by issue #76033, Video Sequence Editor crash with prefetch and meta strips
|
@ -1225,6 +1225,10 @@ struct ImBuf *BKE_sequencer_cache_get(
|
|||
seq = BKE_sequencer_prefetch_get_original_sequence(seq, scene);
|
||||
}
|
||||
|
||||
if (!seq) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!scene->ed->cache) {
|
||||
seq_cache_create(context->bmain, scene);
|
||||
}
|
||||
|
@ -1287,6 +1291,10 @@ bool BKE_sequencer_cache_put_if_possible(const SeqRenderData *context,
|
|||
seq = BKE_sequencer_prefetch_get_original_sequence(seq, scene);
|
||||
}
|
||||
|
||||
if (!seq) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (BKE_sequencer_cache_recycle_item(scene)) {
|
||||
BKE_sequencer_cache_put(context, seq, cfra, type, ibuf, cost, skip_disk_cache);
|
||||
return true;
|
||||
|
|
|
@ -134,19 +134,29 @@ static bool seq_prefetch_job_is_waiting(Scene *scene)
|
|||
return pfjob->waiting;
|
||||
}
|
||||
|
||||
static Sequence *sequencer_prefetch_get_original_sequence(Sequence *seq, ListBase *seqbase)
|
||||
{
|
||||
LISTBASE_FOREACH (Sequence *, seq_orig, seqbase) {
|
||||
if (strcmp(seq->name, seq_orig->name) == 0) {
|
||||
return seq_orig;
|
||||
}
|
||||
|
||||
if (seq_orig->type == SEQ_TYPE_META) {
|
||||
Sequence *match = sequencer_prefetch_get_original_sequence(seq, &seq_orig->seqbase);
|
||||
if (match != NULL) {
|
||||
return match;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* for cache context swapping */
|
||||
Sequence *BKE_sequencer_prefetch_get_original_sequence(Sequence *seq, Scene *scene)
|
||||
{
|
||||
Editing *ed = scene->ed;
|
||||
ListBase *seqbase = &ed->seqbase;
|
||||
Sequence *seq_orig = NULL;
|
||||
|
||||
for (seq_orig = (Sequence *)seqbase->first; seq_orig; seq_orig = seq_orig->next) {
|
||||
if (strcmp(seq->name, seq_orig->name) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return seq_orig;
|
||||
return sequencer_prefetch_get_original_sequence(seq, &ed->seqbase);
|
||||
}
|
||||
|
||||
/* for cache context swapping */
|
||||
|
|
Loading…
Reference in New Issue