Fix errors in sequencer channel headers
Failing constraint test uncovered crashes on NULL dereference and missing channels initialization in `SEQ_editing_ensure()`.
This commit is contained in:
@@ -647,18 +647,20 @@ static eContextResult screen_ctx_selected_editable_sequences(const bContext *C,
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
Scene *scene = WM_window_get_active_scene(win);
|
||||
Editing *ed = SEQ_editing_get(scene);
|
||||
ListBase *channels = SEQ_channels_displayed_get(ed);
|
||||
if (ed) {
|
||||
LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
|
||||
if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq)) {
|
||||
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
||||
}
|
||||
}
|
||||
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
||||
return CTX_RESULT_OK;
|
||||
if (ed == NULL) {
|
||||
return CTX_RESULT_NO_DATA;
|
||||
}
|
||||
return CTX_RESULT_NO_DATA;
|
||||
|
||||
ListBase *channels = SEQ_channels_displayed_get(ed);
|
||||
LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
|
||||
if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq)) {
|
||||
CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
|
||||
}
|
||||
}
|
||||
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
|
||||
return CTX_RESULT_OK;
|
||||
}
|
||||
|
||||
static eContextResult screen_ctx_active_nla_track(const bContext *C, bContextDataResult *result)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -347,6 +347,11 @@ void channel_draw_context_init(const bContext *C,
|
||||
|
||||
void draw_channels(const bContext *C, ARegion *region)
|
||||
{
|
||||
Editing *ed = SEQ_editing_get(CTX_data_scene(C));
|
||||
if (ed == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
SeqChannelDrawContext context;
|
||||
channel_draw_context_init(C, region, &context);
|
||||
|
||||
|
||||
@@ -245,6 +245,8 @@ Editing *SEQ_editing_ensure(Scene *scene)
|
||||
ed->cache = NULL;
|
||||
ed->cache_flag = SEQ_CACHE_STORE_FINAL_OUT;
|
||||
ed->cache_flag |= SEQ_CACHE_STORE_RAW;
|
||||
ed->displayed_channels = &ed->channels;
|
||||
SEQ_channels_ensure(ed->displayed_channels);
|
||||
}
|
||||
|
||||
return scene->ed;
|
||||
|
||||
Reference in New Issue
Block a user