Fix T80996: Weight Proximity modifier: crash going to editmode on a

target in certain situations

Regression from rBdeaff945d0b96.

mesh_ensure_looptri_data would overflow.

Crash would only happen if a Data Transfer modifier (transferring
UVs) follows, so exact reason for this is not yet entirely clear. Also
there are edit-mode versions of the following BVH lookup functions so it
could be avoided (since this is a expensive operation), marking as TODO.

Similar fix as
- rB0945a79ed1eafae444d3021a5912cb39801a7209
- rB56d7e39b92997768b3db8ce2dbc262f869994145

Reviewers: mont29, campbellbarton

Maniphest Tasks: T80996

Differential Revision: https://developer.blender.org/D8973
This commit is contained in:
Philipp Oeser 2020-09-21 17:48:57 +02:00
parent 3cbc5dd90e
commit d037ac315b
Notes: blender-bot 2023-02-14 07:36:17 +01:00
Referenced by issue #80996, Weight Proximity modifier: crash going to editmode on a target in certain situations
Referenced by issue #80396, Potential candidates for corrective releases
1 changed files with 6 additions and 0 deletions

View File

@ -45,6 +45,7 @@
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_mesh.h"
#include "BKE_mesh_wrapper.h"
#include "BKE_modifier.h"
#include "BKE_screen.h"
#include "BKE_texture.h" /* Texture masking. */
@ -552,6 +553,11 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
/* We must check that we do have a valid target_mesh! */
if (target_mesh != NULL) {
/* TODO: edit-mode versions of the BVH lookup functions are available so it could be
* avoided. */
BKE_mesh_wrapper_ensure_mdata(target_mesh);
SpaceTransform loc2trgt;
float *dists_v = use_trgt_verts ? MEM_malloc_arrayN(numIdx, sizeof(float), "dists_v") :
NULL;