Fix T70386: Crash when snapping to edges in specific situations

The callbacks get elements through indexes,
so make sure they're not "dirty".
This commit is contained in:
Germano Cavalcante 2019-10-15 14:59:16 -03:00
parent 2a9b162d94
commit cfb6ffd48f
Notes: blender-bot 2023-02-14 04:10:15 +01:00
Referenced by issue #70872, Cannot rotate scene in 3D viewport, 2.81
Referenced by issue #70386, Crash on isect_ray_seg_v3 due to the v0 and v1 being the same vert
1 changed files with 2 additions and 0 deletions

View File

@ -2368,6 +2368,7 @@ static short snapEditMesh(SnapObjectContext *sctx,
if (treedata_vert && (snapdata->snap_to_flag & SCE_SNAP_MODE_VERTEX)) {
BM_mesh_elem_table_ensure(em->bm, BM_VERT);
BM_mesh_elem_index_ensure(em->bm, BM_VERT);
BLI_bvhtree_find_nearest_projected(treedata_vert->tree,
lpmat,
snapdata->win_size,
@ -2383,6 +2384,7 @@ static short snapEditMesh(SnapObjectContext *sctx,
int last_index = nearest.index;
nearest.index = -1;
BM_mesh_elem_table_ensure(em->bm, BM_EDGE | BM_VERT);
BM_mesh_elem_index_ensure(em->bm, BM_EDGE | BM_VERT);
BLI_bvhtree_find_nearest_projected(treedata_edge->tree,
lpmat,
snapdata->win_size,