diff options
author | Jacques Lucke <jacques@blender.org> | 2022-02-24 14:44:02 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-02-24 14:44:02 +0300 |
commit | 17e0634902b7fc8987918e02bc2d4e2090c32e02 (patch) | |
tree | 5b33eb6f91ab49838f631719d371f21d777b53e4 | |
parent | e767a2d98bd0ec1e62b639d0307f49536a288c31 (diff) |
Fix T95985: crash when assigning a name for an output attribute
This was a double free error which happened because `BM_mesh_bm_from_me`
was taking ownership of arrays that were still owned by the Mesh. Note that
this only happens when the mesh is empty but some custom data layers still
have a non-null data pointer. While usually the data pointer should be null in
this case for performance reasons, other functions should still be able to
handle this situation.
Differential Revision: https://developer.blender.org/D14181
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_convert.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc b/source/blender/bmesh/intern/bmesh_mesh_convert.cc index 4635da29d34..ee0e5789169 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc @@ -226,10 +226,10 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar if (!me || !me->totvert) { if (me && is_new) { /* No verts? still copy custom-data layout. */ - CustomData_copy(&me->vdata, &bm->vdata, mask.vmask, CD_ASSIGN, 0); - CustomData_copy(&me->edata, &bm->edata, mask.emask, CD_ASSIGN, 0); - CustomData_copy(&me->ldata, &bm->ldata, mask.lmask, CD_ASSIGN, 0); - CustomData_copy(&me->pdata, &bm->pdata, mask.pmask, CD_ASSIGN, 0); + CustomData_copy(&me->vdata, &bm->vdata, mask.vmask, CD_DEFAULT, 0); + CustomData_copy(&me->edata, &bm->edata, mask.emask, CD_DEFAULT, 0); + CustomData_copy(&me->ldata, &bm->ldata, mask.lmask, CD_DEFAULT, 0); + CustomData_copy(&me->pdata, &bm->pdata, mask.pmask, CD_DEFAULT, 0); CustomData_bmesh_init_pool(&bm->vdata, me->totvert, BM_VERT); CustomData_bmesh_init_pool(&bm->edata, me->totedge, BM_EDGE); |