Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-03-08 10:47:22 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-08 10:47:22 +0300
commitcbf033c05519ffa977693a5f6845b476017af08b (patch)
treeb734390cd622b72fd7d4d8dd37a5fcae3a0f54eb /source/blender/blenkernel/intern/cryptomatte.cc
parent89757f918cfa9e087f1a55f7c94688a1f623b612 (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.cc11
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;