Fix T46067: ShrinkWrap + Threaded depsgraph crash

Note that allocating DM arrays from an editmesh is currently not threadsafe,
however even if were resolved, its more efficient to avoid having to do it in the first place.
This commit is contained in:
Campbell Barton 2015-09-10 18:27:50 +10:00
parent ac0e511619
commit 1d1b8bb196
Notes: blender-bot 2023-02-14 08:40:34 +01:00
Referenced by issue #46069, Crash when saving a render with non-fullscreen file editor
Referenced by issue #46067, Edit mode crash
1 changed files with 9 additions and 0 deletions

View File

@ -50,6 +50,7 @@
#include "BKE_lattice.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_mesh.h" /* for OMP limits. */
#include "BKE_subsurf.h"
@ -278,6 +279,14 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, bool for
BLI_SPACE_TRANSFORM_SETUP(&local2aux, calc->ob, calc->smd->auxTarget);
}
/* use editmesh to avoid array allocation */
if (calc->smd->target && calc->target->type == DM_TYPE_EDITBMESH) {
treeData.em_evil = BKE_editmesh_from_object(calc->smd->target);
}
if (calc->smd->auxTarget && auxMesh->type == DM_TYPE_EDITBMESH) {
auxData.em_evil = BKE_editmesh_from_object(calc->smd->auxTarget);
}
/* After sucessufuly build the trees, start projection vertexs */
if (bvhtree_from_mesh_looptri(&treeData, calc->target, 0.0, 4, 6) &&
(auxMesh == NULL || bvhtree_from_mesh_looptri(&auxData, auxMesh, 0.0, 4, 6)))