From 4b8200666cce614ced379f6e1c7c785917eb7644 Mon Sep 17 00:00:00 2001 From: Pratik Borhade Date: Fri, 31 Mar 2023 15:59:29 +0530 Subject: [PATCH] Fix #106246: Crash on deleting the multi-level hierarchy Crash occurs due to accessing the pointer which points to garbage memory. In brief, `base_next` points to next base element (`base->next`) which is deleted in previous iteration. After `BKE_library_ID_is_indirectly_used` call, viewlayer is synced and frees the `object_bases` list. It results `base_next` pointing to garbage memory. To fix this, point to `base->next` after `BKE_library_ID_is_indirectly_used` function call, --- source/blender/editors/space_outliner/outliner_tools.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index d8d9718ccd6..f409266998b 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -2191,8 +2191,6 @@ static Base *outliner_batch_delete_hierarchy( } } - base_next = base->next; - if (object->id.tag & LIB_TAG_INDIRECT) { BKE_reportf(reports, RPT_WARNING, @@ -2211,6 +2209,8 @@ static Base *outliner_batch_delete_hierarchy( return base_next; } + base_next = base->next; + DEG_id_tag_update_ex(bmain, &object->id, ID_RECALC_BASE_FLAGS); BKE_scene_collections_object_remove(bmain, scene, object, false); -- 2.30.2