From 11292edba6ec361cc7142c4e2d9af0289cd895bb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 7 Jan 2020 17:38:16 +1100 Subject: BMesh: remove BMEditMesh.ob pointer Remove this pointer since it's linking Mesh data back to the object, where a single edit-mesh may have multiple object users, causing incorrect assumptions in the code. Resolves dangling pointer part of the T72667 crash, although there are other issues which still need to be fixed. In EDBM_op_finish and EDBM_update_generic, full Main lookups have been added which should be replaced with mesh argument or the update tagging moved elsewhere. --- source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source/blender/depsgraph') diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index afb73a84afe..996d807480d 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -610,7 +610,7 @@ void update_lattice_edit_mode_pointers(const Depsgraph * /*depsgraph*/, lt_cow->editlatt = lt_orig->editlatt; } -void update_mesh_edit_mode_pointers(const Depsgraph *depsgraph, const ID *id_orig, ID *id_cow) +void update_mesh_edit_mode_pointers(const ID *id_orig, ID *id_cow) { /* For meshes we need to update edit_mesh to make it to point * to the CoW version of object. @@ -624,7 +624,6 @@ void update_mesh_edit_mode_pointers(const Depsgraph *depsgraph, const ID *id_ori return; } mesh_cow->edit_mesh = (BMEditMesh *)MEM_dupallocN(mesh_orig->edit_mesh); - mesh_cow->edit_mesh->ob = (Object *)depsgraph->get_cow_id(&mesh_orig->edit_mesh->ob->id); mesh_cow->edit_mesh->mesh_eval_cage = NULL; mesh_cow->edit_mesh->mesh_eval_final = NULL; } @@ -639,7 +638,7 @@ void update_edit_mode_pointers(const Depsgraph *depsgraph, const ID *id_orig, ID update_armature_edit_mode_pointers(depsgraph, id_orig, id_cow); break; case ID_ME: - update_mesh_edit_mode_pointers(depsgraph, id_orig, id_cow); + update_mesh_edit_mode_pointers(id_orig, id_cow); break; case ID_CU: update_curve_edit_mode_pointers(depsgraph, id_orig, id_cow); -- cgit v1.2.3