Fix #141332: Add movie operator crashes Blender

PR #141419 gated init behind a `nullptr` check, but it would still try
to run transform engine code, which accesses the unset region. Fix by
preventing any sort of `move_strips` operation when `region` doesn't
exist.

Pull Request: https://projects.blender.org/blender/blender/pulls/141582
This commit is contained in:
John Kiril Swenson
2025-07-09 08:38:45 +02:00
committed by John Kiril Swenson
parent d3a8bfc83a
commit cfc495bb2e

View File

@@ -383,7 +383,8 @@ static void restore_move_strips_state(wmOperator *op)
static bool load_data_init_from_operator(seq::LoadData *load_data, bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
const Main *bmain = CTX_data_main(C);
const ARegion *region = CTX_wm_region(C);
PropertyRNA *prop;
const bool relative = (prop = RNA_struct_find_property(op->ptr, "relative_path")) &&
@@ -482,9 +483,14 @@ static bool load_data_init_from_operator(seq::LoadData *load_data, bContext *C,
}
}
const ARegion *region = CTX_wm_region(C);
if (region == nullptr) {
RNA_boolean_set(op->ptr, "move_strips", false);
}
/* Override strip position by current mouse position. */
if (RNA_boolean_get(op->ptr, "move_strips") && region != nullptr) {
if ((prop = RNA_struct_find_property(op->ptr, "move_strips")) &&
RNA_property_boolean_get(op->ptr, prop))
{
const wmWindow *win = CTX_wm_window(C);
const float2 mouse_region(win->eventstate->xy[0] - region->winrct.xmin,
win->eventstate->xy[1] - region->winrct.ymin);