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/blenkernel/BKE_lib_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/blenkernel/BKE_lib_id.h')
-rw-r--r-- | source/blender/blenkernel/BKE_lib_id.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index adac92105ee..6b706f3bcd0 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -104,6 +104,10 @@ enum { * specific code in some copy cases (mostly for node trees). */ LIB_ID_CREATE_LOCAL = 1 << 9, + /** Create for the depsgraph, when set #LIB_TAG_COPIED_ON_WRITE must be set. + * Internally this is used to share some pointers instead of duplicating them. */ + LIB_ID_COPY_SET_COPIED_ON_WRITE = 1 << 10, + /* *** Specific options to some ID types or usages. *** */ /* *** May be ignored by unrelated ID copying functions. *** */ /** Object only, needed by make_local code. */ |