diff options
author | Richard Antalik <richardantalik@gmail.com> | 2021-11-30 12:06:23 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2021-11-30 12:08:22 +0300 |
commit | d7f0de0e3aea23afba286297ab98ebdd86a41507 (patch) | |
tree | f7966bcfa4b6547077cfbe77f6c6c0a664281566 /source/blender/sequencer | |
parent | 7168a4fa5c785c29483947ce60ac797e4b9c1bfc (diff) |
Fix T93442: Crash when proxy building is cancelled
If strip is removed while proxy is built, this causes crash when
building is finished. This happens because proxy anims are freed in
`SEQ_proxy_rebuild_finish()`.
Iterate over available strips and check if original strip still exists
by comparing `SessionUUID`.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D13408
Diffstat (limited to 'source/blender/sequencer')
-rw-r--r-- | source/blender/sequencer/intern/proxy.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/sequencer/intern/proxy.c b/source/blender/sequencer/intern/proxy.c index 2bc294c91cd..30afa3f9c59 100644 --- a/source/blender/sequencer/intern/proxy.c +++ b/source/blender/sequencer/intern/proxy.c @@ -34,6 +34,7 @@ #include "BLI_fileops.h" #include "BLI_listbase.h" #include "BLI_path_util.h" +#include "BLI_session_uuid.h" #include "BLI_string.h" #ifdef WIN32 @@ -54,6 +55,7 @@ #include "IMB_imbuf_types.h" #include "IMB_metadata.h" +#include "SEQ_iterator.h" #include "SEQ_proxy.h" #include "SEQ_relations.h" #include "SEQ_render.h" @@ -79,6 +81,7 @@ typedef struct SeqIndexBuildContext { Depsgraph *depsgraph; Scene *scene; Sequence *seq, *orig_seq; + SessionUUID orig_seq_uuid; } SeqIndexBuildContext; int SEQ_rendersize_to_proxysize(int render_size) @@ -458,6 +461,7 @@ bool SEQ_proxy_rebuild_context(Main *bmain, context->depsgraph = depsgraph; context->scene = scene; context->orig_seq = seq; + context->orig_seq_uuid = seq->runtime.session_uuid; context->seq = nseq; context->view_id = i; /* only for images */ @@ -560,6 +564,18 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, } } +static bool seq_orig_free_anims(Sequence *seq_iter, void *data) +{ + SessionUUID orig_seq_uuid = ((SeqIndexBuildContext *)data)->orig_seq_uuid; + + if (BLI_session_uuid_is_equal(&seq_iter->runtime.session_uuid, &orig_seq_uuid)) { + for (StripAnim *sanim = seq_iter->anims.first; sanim; sanim = sanim->next) { + IMB_close_anim_proxies(sanim->anim); + } + } + return true; +} + void SEQ_proxy_rebuild_finish(SeqIndexBuildContext *context, bool stop) { if (context->index_context) { @@ -569,9 +585,8 @@ void SEQ_proxy_rebuild_finish(SeqIndexBuildContext *context, bool stop) IMB_close_anim_proxies(sanim->anim); } - for (sanim = context->orig_seq->anims.first; sanim; sanim = sanim->next) { - IMB_close_anim_proxies(sanim->anim); - } + /* `context->seq_orig` may have been removed during building. */ + SEQ_for_each_callback(&context->scene->ed->seqbase, seq_orig_free_anims, context); IMB_anim_index_rebuild_finish(context->index_context, stop); } |