diff options
author | Campbell Barton <campbell@blender.org> | 2022-08-12 14:45:21 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-08-12 14:49:06 +0300 |
commit | 4dc9a8a21e82d1c56419713c517b38728993ed8a (patch) | |
tree | 97dfc01da748f434d0586baa472e93db3f75b622 /source | |
parent | 4d2e2a66912fc22f6092492b1450a5c110d1949d (diff) |
Fix T100191: Crash with the wave modifier using normals in edit-mode
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/modifiers/intern/MOD_wave.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index b92e3a0fa9d..ba7fb3fa1ba 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -327,8 +327,12 @@ static void deformVertsEM(ModifierData *md, Mesh *mesh_src = NULL; if (wmd->flag & MOD_WAVE_NORM) { + /* NOTE(@campbellbarton): don't request normals here because `use_normals == false` + * because #BKE_mesh_wrapper_ensure_mdata has not run yet. + * While this could be supported the argument is documented to be removed, + * so pass false here and let the normals be created when requested. */ mesh_src = MOD_deform_mesh_eval_get( - ctx->object, editData, mesh, vertexCos, verts_num, true, false); + ctx->object, editData, mesh, vertexCos, verts_num, false, false); } else if (wmd->texture != NULL || wmd->defgrp_name[0] != '\0') { mesh_src = MOD_deform_mesh_eval_get( @@ -343,6 +347,12 @@ static void deformVertsEM(ModifierData *md, waveModifier_do(wmd, ctx, ctx->object, mesh_src, vertexCos, verts_num); if (!ELEM(mesh_src, NULL, mesh)) { + /* Important not to free `vertexCos` owned by the caller. */ + EditMeshData *edit_data = mesh_src->runtime.edit_data; + if (edit_data->vertexCos == vertexCos) { + edit_data->vertexCos = NULL; + } + BKE_id_free(NULL, mesh_src); } } |