diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-05-18 05:53:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-05-18 06:35:00 +0300 |
commit | dfb963c70df515213c452094c20c83720bc017ee (patch) | |
tree | 039b2e3b0aa8fa192d19e4545ce9332dbaee9337 /source/blender/makesdna/DNA_ID.h | |
parent | cdc1ddf20bcf6b0a3783039a3828847afd3fd633 (diff) |
Fix T88026: Repeated switch to rendered viewport crashes
Resolve ownership ambiguity with shared physics pointers.
Previously, LIB_ID_CREATE_NO_MAIN allowed pointer sharing with
the source ID so physics caches can be shared between original and
evaluated data: (Object.soft.shared & Object.rigidbody_object.shared).
This only worked properly for LIB_TAG_COPIED_ON_WRITE ID's,
as LIB_TAG_NO_MAIN can be used in situations where the original ID's
lifetime limited by it's original data.
This commit adds `LIB_ID_COPY_SET_COPIED_ON_WRITE` so ID's only share
memory with original data for ID's evaluated in the depsgraph.
For all other uses, a full copy of physics data is made.
Ref D11228#287094
Diffstat (limited to 'source/blender/makesdna/DNA_ID.h')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index fa60bba54d5..8bf9afafa1b 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -555,8 +555,15 @@ enum { /* RESET_AFTER_USE tag existing data before linking so we know what is new. */ LIB_TAG_PRE_EXISTING = 1 << 11, - /* The data-block is a copy-on-write/localized version. */ + /** + * The data-block is a copy-on-write/localized version. + * + * \warning This should not be cleared on existing data. + * If support for this is needed, see T88026 as this flag controls memory ownership + * of physics *shared* pointers. + */ LIB_TAG_COPIED_ON_WRITE = 1 << 12, + LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT = 1 << 13, LIB_TAG_LOCALIZED = 1 << 14, |