From 9de3ed5c823ed79c3584765141d4f1c160add4d3 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Thu, 21 Apr 2022 14:07:57 -0300 Subject: Fix T97490: snap to multiple objects with linked data can crash The problem is old. rB52be06301257 (fixed by rB4b35d6950d4f) just masked it. `Object->data`, on evaluated objects, is not a safe pointer to get objects with the same `BMEditData`. Use `Object->runtime.data_orig` instead. --- source/blender/editors/transform/transform_snap_object.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/transform/transform_snap_object.cc b/source/blender/editors/transform/transform_snap_object.cc index ab78ef6a5aa..abeb376a9a6 100644 --- a/source/blender/editors/transform/transform_snap_object.cc +++ b/source/blender/editors/transform/transform_snap_object.cc @@ -242,7 +242,7 @@ static SnapObjectData *snap_object_data_lookup(SnapObjectContext *sctx, Object * if (sod == nullptr) { if (sctx->cache.data_to_object_map != nullptr) { ob_eval = static_cast( - BLI_ghash_lookup(sctx->cache.data_to_object_map, ob_eval->data)); + BLI_ghash_lookup(sctx->cache.data_to_object_map, ob_eval->runtime.data_orig)); /* Could be NULl when mixing edit-mode and non edit-mode objects. */ if (ob_eval != nullptr) { sod = static_cast(BLI_ghash_lookup(sctx->cache.object_map, ob_eval)); @@ -369,7 +369,7 @@ static SnapObjectData *snap_object_data_editmesh_get(SnapObjectContext *sctx, sctx->cache.data_to_object_map = BLI_ghash_ptr_new(__func__); } void **ob_p; - if (BLI_ghash_ensure_p(sctx->cache.data_to_object_map, ob_eval->data, &ob_p)) { + if (BLI_ghash_ensure_p(sctx->cache.data_to_object_map, ob_eval->runtime.data_orig, &ob_p)) { ob_eval = static_cast(*ob_p); } else { -- cgit v1.2.3