diff options
author | Jacques Lucke <jacques@blender.org> | 2021-05-13 14:06:09 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-05-13 14:06:09 +0300 |
commit | 6b33dafb64f2e846eb4c7518a18f5cc011aed199 (patch) | |
tree | c3a5c177ab7e2ae51a35c82bb993d3f61fe8e127 /source/blender/blenkernel/BKE_node_ui_storage.hh | |
parent | 250a5442cf53a7fc435ecc293517e24ef6bcb46f (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.hh | 8 |
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 { |