From d7cd25fc94cfbe4ffdcf7a137d2256f5a26c6538 Mon Sep 17 00:00:00 2001 From: Pratik Borhade Date: Fri, 19 Apr 2024 20:27:02 +0200 Subject: [PATCH] Fix #120731: sculpt trim tool crash Caused by f7d5ec8661cac87553c9aa199b38d65a8052d666 `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 --- source/blender/editors/sculpt_paint/sculpt_trim.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/sculpt_paint/sculpt_trim.cc b/source/blender/editors/sculpt_paint/sculpt_trim.cc index 838c9e8f30b..e960a432b13 100644 --- a/source/blender/editors/sculpt_paint/sculpt_trim.cc +++ b/source/blender/editors/sculpt_paint/sculpt_trim.cc @@ -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( - MEM_cnew(__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( + MEM_cnew(__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( + MEM_cnew(__func__)); initialize_cursor_info(*C, *op, *gesture_data); init_operation(*gesture_data, *op);