Fix #119384: Outliner mode column crash with shared object data #119745

Closed
Hans Goudey wants to merge 3 commits from HooglyBoogly:fix-outliner-mode-switch-crash into blender-v4.1-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

3 Commits

Author SHA1 Message Date
Hans Goudey fd9a7c6317 Fix crash with no active object 2024-03-21 13:35:13 -04:00
Hans Goudey e5e00f68ee Merge branch 'blender-v4.1-release' into fix-outliner-mode-switch-crash 2024-03-21 13:26:13 -04:00
Hans Goudey a91b5ab8ad Fix #119384: Outliner mode column crash with shared object data
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
The outliner is meant to check whether each object's data is currently
in the active mode when choosing whether to use "extend" behavior for
the mode switching column. That check worked for when the object data
is shared with the active object, but not any other object currently
in the active mode. The incorrect check caused the "extend" behavior
to turn off, making it exit edit mode for the object data without
handing the other objects using the data.

The simplest way of checking whether an object's data is in the active
mode is putting all the object data in a Set. Storing the set once
when building the outliner view context also avoids quadratic cost,
since the state needs to be checked for every object.

This does raise some questions about whether the mode is a property of
the object or the object data in practice. Also, I find the way the
outliner's callback is always "toggle" rather than "enter" or "exit" is
a bit weak. And the fact that the mode switching API allows this is
unfortunate as well. But this is the most clearly correct non-invasive
change to avoid the crash.
2024-03-21 09:37:37 -04:00