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-26 15:19:01 +0300
committerJacques Lucke <jacques@blender.org>2021-05-26 15:19:01 +0300
commitb67423f80663990f972f4317d38b8e7662b9e8eb (patch)
tree7b682f45fbfdb96517d14632ce594c108ebcf87a /source/blender/blenkernel/BKE_node_ui_storage.hh
parentafec66c024dc2b75447537d45406c06342ec201e (diff)
Nodes: fix threading issues with node ui storage
Calling BKE_nodetree_attribute_hint_add from multiple threads still was not safe before.. One issue was that context_map embedded its values directly. So when context_map grows, all NodeUIStorage would move as well. I could patch around that by using std::unique_ptr in a few places, but that just becomes too complex for now. Instead I simplified the locking a bit by adding just locking a mutex in NodeTreeUIStorage all the time while an attribute hint is added. Differential Revision: https://developer.blender.org/D11399
Diffstat (limited to 'source/blender/blenkernel/BKE_node_ui_storage.hh')
-rw-r--r--source/blender/blenkernel/BKE_node_ui_storage.hh10
1 files changed, 1 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_node_ui_storage.hh b/source/blender/blenkernel/BKE_node_ui_storage.hh
index 8bf89cd8f58..4ec165aad8c 100644
--- a/source/blender/blenkernel/BKE_node_ui_storage.hh
+++ b/source/blender/blenkernel/BKE_node_ui_storage.hh
@@ -95,21 +95,13 @@ 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 {
+ std::mutex mutex;
blender::Map<NodeTreeEvaluationContext, blender::Map<std::string, NodeUIStorage>> context_map;
- std::mutex context_map_mutex;
/**
* Attribute search uses this to store the fake info for the string typed into a node, in order