Fix: make sure geometry owns mesh before taking ownership

Differential Revision: https://developer.blender.org/D13075
This commit is contained in:
Jacques Lucke 2021-11-03 10:42:48 +01:00
parent 68759625b1
commit 2b12b4cd7d
1 changed files with 4 additions and 0 deletions

View File

@ -921,6 +921,10 @@ static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md,
/* Release the mesh from the geometry set again. */
if (geometry_set.has<MeshComponent>()) {
MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
if (mesh_component.get_for_read() != input_mesh) {
/* Make sure the mesh component actually owns the mesh before taking over ownership. */
mesh_component.ensure_owns_direct_data();
}
mesh_output = mesh_component.release();
}