From 0f26332d5d9a5cb6363afb3416a1bebd0d936230 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 6 Jun 2019 10:39:44 +0200 Subject: Remove mutex lock from node localization There is no obvious threading-unsafe code in the localization. The main source of issues were the new_node/new_socket pointers which are no longer used during node tree duplication. --- source/blender/blenkernel/intern/node.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 6ff0bb96004..e1f7a346b1c 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -322,7 +322,6 @@ void ntreeSetTypes(const struct bContext *C, bNodeTree *ntree) static GHash *nodetreetypes_hash = NULL; static GHash *nodetypes_hash = NULL; static GHash *nodesockettypes_hash = NULL; -static SpinLock spin; bNodeTreeType *ntreeTypeFind(const char *idname) { @@ -1426,8 +1425,6 @@ void BKE_node_tree_copy_data(Main *UNUSED(bmain), /* in case a running nodetree is copied */ ntree_dst->execdata = NULL; - ntree_dst->duplilock = NULL; - BLI_listbase_clear(&ntree_dst->nodes); BLI_listbase_clear(&ntree_dst->links); @@ -2046,10 +2043,6 @@ void ntreeFreeTree(bNodeTree *ntree) BKE_node_instance_hash_free(ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free); } - if (ntree->duplilock) { - BLI_mutex_free(ntree->duplilock); - } - if (ntree->id.tag & LIB_TAG_LOCALIZED) { BKE_libblock_free_data(&ntree->id, true); } @@ -2227,14 +2220,6 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) bNodeTree *ltree; bNode *node; - BLI_spin_lock(&spin); - if (!ntree->duplilock) { - ntree->duplilock = BLI_mutex_alloc(); - } - BLI_spin_unlock(&spin); - - BLI_mutex_lock(ntree->duplilock); - /* Make full copy outside of Main database. * Note: previews are not copied here. */ @@ -2264,8 +2249,6 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) ntree->typeinfo->localize(ltree, ntree); } - BLI_mutex_unlock(ntree->duplilock); - return ltree; } else { @@ -3978,7 +3961,6 @@ void init_nodesystem(void) nodetreetypes_hash = BLI_ghash_str_new("nodetreetypes_hash gh"); nodetypes_hash = BLI_ghash_str_new("nodetypes_hash gh"); nodesockettypes_hash = BLI_ghash_str_new("nodesockettypes_hash gh"); - BLI_spin_init(&spin); register_undefined_types(); -- cgit v1.2.3