From 8675fc50dcc07e0a6a8675400413e862c90e1693 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Mon, 19 Feb 2024 15:18:19 +0100 Subject: [PATCH] Fix #105968: Crash when delete linked object in scenes Outliner Problem here is that when selecting/activating an object in a different scene in the Outliner, the Outliner will automatically switch scenes via `WM_window_set_active_scene` however the `view_layer` was untouched and as a consequence `BKE_view_layer_synced_ensure` gets the right scene but the "wrong" viewlayer [which makes it not do its thing properly] To solve, now use the new active viewlayer after having switched scenes. NOTE this also solves a couple of other asserts elsewhere (when not deleting, just selecting/activating could assert on `DEG_is_evaluated_object(ob)`) Pull Request: https://projects.blender.org/blender/blender/pulls/118458 --- source/blender/editors/space_outliner/outliner_select.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/editors/space_outliner/outliner_select.cc b/source/blender/editors/space_outliner/outliner_select.cc index e67d565a796..cc9f7350a51 100644 --- a/source/blender/editors/space_outliner/outliner_select.cc +++ b/source/blender/editors/space_outliner/outliner_select.cc @@ -324,6 +324,7 @@ static void tree_element_object_activate(bContext *C, sce = (Scene *)outliner_search_back(te, ID_SCE); if (sce && scene != sce) { WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), sce); + view_layer = WM_window_get_active_view_layer(CTX_wm_window(C)); scene = sce; }