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:
authorJacques Lucke <jacques@blender.org>2021-05-13 14:06:09 +0300
committerJacques Lucke <jacques@blender.org>2021-05-13 14:06:09 +0300
commit6b33dafb64f2e846eb4c7518a18f5cc011aed199 (patch)
treec3a5c177ab7e2ae51a35c82bb993d3f61fe8e127 /source/blender/blenkernel/BKE_node_ui_storage.hh
parent250a5442cf53a7fc435ecc293517e24ef6bcb46f (diff)
Geometry Nodes: add mutex for node ui storage
Previously, multiple threads adding information to node ui storage at the same time resulted in memory corruption. The lock prevents that, but might potentially become a bottleneck in the future. For now favour correctness over a potential performance bottleneck.
Diffstat (limited to 'source/blender/blenkernel/BKE_node_ui_storage.hh')
-rw-r--r--source/blender/blenkernel/BKE_node_ui_storage.hh8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_node_ui_storage.hh b/source/blender/blenkernel/BKE_node_ui_storage.hh
index 5f9c039ef9e..8bf89cd8f58 100644
--- a/source/blender/blenkernel/BKE_node_ui_storage.hh
+++ b/source/blender/blenkernel/BKE_node_ui_storage.hh
@@ -95,8 +95,16 @@ struct AvailableAttributeInfo {
};
struct NodeUIStorage {
+ std::mutex mutex;
blender::Vector<NodeWarning> warnings;
blender::Set<AvailableAttributeInfo> attribute_hints;
+
+ NodeUIStorage() = default;
+ /* Needed because the mutex can't be moved or copied. */
+ NodeUIStorage(NodeUIStorage &&other)
+ : warnings(std::move(other.warnings)), attribute_hints(std::move(other.attribute_hints))
+ {
+ }
};
struct NodeTreeUIStorage {