diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-03-08 10:47:22 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-03-08 10:47:22 +0300 |
commit | cbf033c05519ffa977693a5f6845b476017af08b (patch) | |
tree | b734390cd622b72fd7d4d8dd37a5fcae3a0f54eb /source/blender/blenkernel/intern/cryptomatte.cc | |
parent | 89757f918cfa9e087f1a55f7c94688a1f623b612 (diff) |
Fix T86026: Crash Opening Cryptomatte File.
But this time the root cause. Writing undo files is done in a separate
thread. This patch moved the updating of the matte_id when the user
actually changes the matte.
Diffstat (limited to 'source/blender/blenkernel/intern/cryptomatte.cc')
-rw-r--r-- | source/blender/blenkernel/intern/cryptomatte.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/cryptomatte.cc b/source/blender/blenkernel/intern/cryptomatte.cc index 3188656aa6b..6db471e830b 100644 --- a/source/blender/blenkernel/intern/cryptomatte.cc +++ b/source/blender/blenkernel/intern/cryptomatte.cc @@ -208,6 +208,17 @@ void BKE_cryptomatte_matte_id_to_entries(NodeCryptomatte *node_storage, const ch BLI_freelistN(&node_storage->entries); std::optional<CryptomatteSession> session = std::nullopt; + if (matte_id == nullptr) { + MEM_SAFE_FREE(node_storage->matte_id); + return; + } + /* Update the matte_id so the files can be opened in versions that don't + * use `CryptomatteEntry`. */ + if (matte_id != node_storage->matte_id && STREQ(node_storage->matte_id, matte_id)) { + MEM_SAFE_FREE(node_storage->matte_id); + node_storage->matte_id = static_cast<char *>(MEM_dupallocN(matte_id)); + } + std::istringstream ss(matte_id); while (ss.good()) { CryptomatteEntry *entry = nullptr; |