Fix #120731: sculpt trim tool crash

Caused by f7d5ec8661
`initialize_cursor_info` requires `gesture_data.operation` initialized.
So move allocation outside of `init_operation`

Pull Request: https://projects.blender.org/blender/blender/pulls/120733
This commit is contained in:
Pratik Borhade
2024-04-19 20:27:02 +02:00
committed by Hans Goudey
parent 55c1abb8a0
commit d7cd25fc94

View File

@@ -598,9 +598,6 @@ static void gesture_end(bContext & /*C*/, gesture::GestureData &gesture_data)
static void init_operation(gesture::GestureData &gesture_data, wmOperator &op)
{
gesture_data.operation = reinterpret_cast<gesture::Operation *>(
MEM_cnew<TrimOperation>(__func__));
TrimOperation *trim_operation = (TrimOperation *)gesture_data.operation;
trim_operation->op.begin = gesture_begin;
@@ -725,6 +722,8 @@ static int gesture_box_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
gesture_data->operation = reinterpret_cast<gesture::Operation *>(
MEM_cnew<TrimOperation>(__func__));
initialize_cursor_info(*C, *op, *gesture_data);
init_operation(*gesture_data, *op);
@@ -754,6 +753,8 @@ static int gesture_lasso_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
gesture_data->operation = reinterpret_cast<gesture::Operation *>(
MEM_cnew<TrimOperation>(__func__));
initialize_cursor_info(*C, *op, *gesture_data);
init_operation(*gesture_data, *op);