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
This commit is contained in:
Philipp Oeser
2024-02-19 15:18:19 +01:00
committed by Philipp Oeser
parent 5d06b7b906
commit 8675fc50dc

View File

@@ -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;
}