fix [#36528] crash when reinitializing bmesh from mesh
This commit is contained in:
@@ -1047,6 +1047,8 @@ static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *
|
||||
int use_shape_key = false;
|
||||
int shape_key_index = 0;
|
||||
|
||||
BPY_BM_CHECK_OBJ(self);
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|iii:from_mesh", (char **)kwlist,
|
||||
&py_mesh, &use_fnorm, &use_shape_key, &shape_key_index) ||
|
||||
!(me = PyC_RNA_AsPointer(py_mesh, "Mesh")))
|
||||
@@ -2918,7 +2920,8 @@ static void bpy_bmvert_dealloc(BPy_BMElem *self)
|
||||
BMesh *bm = self->bm;
|
||||
if (bm) {
|
||||
void **ptr = CustomData_bmesh_get(&bm->vdata, self->ele->head.data, CD_BM_ELEM_PYPTR);
|
||||
*ptr = NULL;
|
||||
if (ptr)
|
||||
*ptr = NULL;
|
||||
}
|
||||
PyObject_DEL(self);
|
||||
}
|
||||
@@ -2928,7 +2931,8 @@ static void bpy_bmedge_dealloc(BPy_BMElem *self)
|
||||
BMesh *bm = self->bm;
|
||||
if (bm) {
|
||||
void **ptr = CustomData_bmesh_get(&bm->edata, self->ele->head.data, CD_BM_ELEM_PYPTR);
|
||||
*ptr = NULL;
|
||||
if (ptr)
|
||||
*ptr = NULL;
|
||||
}
|
||||
PyObject_DEL(self);
|
||||
}
|
||||
@@ -2938,7 +2942,8 @@ static void bpy_bmface_dealloc(BPy_BMElem *self)
|
||||
BMesh *bm = self->bm;
|
||||
if (bm) {
|
||||
void **ptr = CustomData_bmesh_get(&bm->pdata, self->ele->head.data, CD_BM_ELEM_PYPTR);
|
||||
*ptr = NULL;
|
||||
if (ptr)
|
||||
*ptr = NULL;
|
||||
}
|
||||
PyObject_DEL(self);
|
||||
}
|
||||
@@ -2948,7 +2953,8 @@ static void bpy_bmloop_dealloc(BPy_BMElem *self)
|
||||
BMesh *bm = self->bm;
|
||||
if (bm) {
|
||||
void **ptr = CustomData_bmesh_get(&bm->ldata, self->ele->head.data, CD_BM_ELEM_PYPTR);
|
||||
*ptr = NULL;
|
||||
if (ptr)
|
||||
*ptr = NULL;
|
||||
}
|
||||
PyObject_DEL(self);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user