Fix #105715: Freeing the edit-mesh causes future access to fail

The BPyBMesh in `BMesh::py_handle` was invalidated but not cleared,
causing future access to return a 'dead' bmesh.
This commit is contained in:
2023-03-14 13:36:54 +11:00
parent 708e84df90
commit 1c88bf6ce1
2 changed files with 7 additions and 1 deletions

View File

@@ -989,7 +989,11 @@ static PyObject *bpy_bmesh_free(BPy_BMesh *self)
bm_dealloc_editmode_warn(self);
if ((self->flag & BPY_BMFLAG_IS_WRAPPED) == 0) {
if (self->flag & BPY_BMFLAG_IS_WRAPPED) {
/* Ensure further access doesn't return this invalid object, see: #105715. */
bm->py_handle = NULL;
}
else {
BM_mesh_free(bm);
}