Fix #141614: Crash canceling 'Rotate Normal' operation

For optimization, 58af30f9b9 caused the creation of TransData and
`recalc_data` for the `Rotate Normal` operation to be skipped. However
`recalc_data` may still be called if we cancel the operation thus
causing a crash.
This commit is contained in:
Germano Cavalcante
2025-07-08 11:47:13 -03:00
parent 13f32fdf6c
commit b8458b85a5
2 changed files with 10 additions and 5 deletions

View File

@@ -2063,6 +2063,15 @@ static void mesh_transdata_mirror_apply(TransDataContainer *tc)
static void recalcData_mesh(TransInfo *t)
{
if (t->mode == TFM_NORMAL_ROTATION) {
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
/* The Rotate Normal mode uses a custom array and ignores any elements created for the mesh
* in transData and similar structures. */
DEG_id_tag_update(static_cast<ID *>(tc->obedit->data), ID_RECALC_GEOMETRY);
}
return;
}
bool is_canceling = t->state == TRANS_CANCEL;
/* Apply corrections. */
if (!is_canceling) {

View File

@@ -110,13 +110,9 @@ static void applyNormalRotation(TransInfo *t)
BKE_lnor_space_custom_normal_to_data(
bm->lnor_spacearr->lspacearr[lnor_ed->loop_index], lnor_ed->nloc, lnor_ed->clnors_data);
}
/* Replaces `recalc_data`, thus disregarding partial update, mirror, correct customdata and
* other updates. */
DEG_id_tag_update(static_cast<ID *>(tc->obedit->data), ID_RECALC_GEOMETRY);
}
// recalc_data(t);
recalc_data(t);
ED_area_status_text(t->area, str);
}