[Bf-blender-cvs] [0f26332d5d9] master: Remove mutex lock from node localization

Sergey Sharybin noreply at git.blender.org
Thu Jun 6 10:41:37 CEST 2019


Commit: 0f26332d5d9a5cb6363afb3416a1bebd0d936230
Author: Sergey Sharybin
Date:   Thu Jun 6 10:39:44 2019 +0200
Branches: master
https://developer.blender.org/rB0f26332d5d9a5cb6363afb3416a1bebd0d936230

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.

===================================================================

M	source/blender/blenkernel/intern/node.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/makesdna/DNA_node_types.h

===================================================================

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();
 
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a4bdf02c838..6ea61980fd0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3482,7 +3482,6 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
 
   ntree->progress = NULL;
   ntree->execdata = NULL;
-  ntree->duplilock = NULL;
 
   ntree->adt = newdataadr(fd, ntree->adt);
   direct_link_animdata(fd, ntree->adt);
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 342641f00ac..672dbaebae1 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -479,9 +479,6 @@ typedef struct bNodeTree {
   int (*test_break)(void *);
   void (*update_draw)(void *);
   void *tbh, *prh, *sdh, *udh;
-
-  void *duplilock;
-
 } bNodeTree;
 
 /* ntree->type, index */



More information about the Bf-blender-cvs mailing list