diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-06-03 18:08:25 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-06-04 10:34:35 +0300 |
commit | b998a7b384c6a598ea851fbc06a2df8829c34329 (patch) | |
tree | 793596dbb9b642b26240f2629ee855b7301c3fec /source/blender/editors/space_node | |
parent | 351e68e0a4de49912747d97b2e53ffcde45aeb53 (diff) |
Fix T64247: Crash on playback with special shader node tree
The root of the problem goes to the fact that node tree copying
uses source tree and nodes for a temporary storage.
This makes it so multiple dependency graphs can not be reliably
evaluated from different threads if they are using same original
node tree.
Solved by doing the following:
- Commonly used tree copying function (which is used by library
manager) keeps source tree, nodes and sockets untouched.
- All the related areas (like node tree's callback) now have
const qualifier on the input.
- Areas which needs to have those temporary pointers assigned are
now using explicit function.
Would be really cool to get rid of those temporary pointers
completely, but this is a bit tricky due to hairy nature of the
code. Can happen any time now though: is easy enough to generalize
the new pointers mapping.
Note that this change is only intended to solve the crash.
The fact that icons shouldn't be updated on playback will be fixed
as a separate change.
Reviewers: brecht, fclem
Reviewed By: brecht, fclem
Subscribers: brecht, fclem
Differential Revision: https://developer.blender.org/D5002
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_group.c | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 235bc6aeb96..d54a30047e6 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1182,7 +1182,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op) lastnode = ntree->nodes.last; for (node = ntree->nodes.first; node; node = node->next) { if (node->flag & SELECT) { - newnode = BKE_node_copy_ex(ntree, node, LIB_ID_COPY_DEFAULT); + newnode = BKE_node_copy_store_new_pointers(ntree, node, LIB_ID_COPY_DEFAULT); /* to ensure redraws or rerenders happen */ ED_node_tag_update_id(snode->id); @@ -2037,7 +2037,8 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op)) if (node->flag & SELECT) { /* No ID refcounting, this node is virtual, * detached from any actual Blender data currently. */ - bNode *new_node = BKE_node_copy_ex(NULL, node, LIB_ID_CREATE_NO_USER_REFCOUNT); + bNode *new_node = BKE_node_copy_store_new_pointers( + NULL, node, LIB_ID_CREATE_NO_USER_REFCOUNT); BKE_node_clipboard_add_node(new_node); } } @@ -2163,7 +2164,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) /* copy nodes from clipboard */ for (node = clipboard_nodes_lb->first; node; node = node->next) { - bNode *new_node = BKE_node_copy_ex(ntree, node, LIB_ID_COPY_DEFAULT); + bNode *new_node = BKE_node_copy_store_new_pointers(ntree, node, LIB_ID_COPY_DEFAULT); /* pasted nodes are selected */ nodeSetSelected(new_node, true); diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 08328681f7a..a0729a15db7 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -439,7 +439,7 @@ static int node_group_separate_selected( if (make_copy) { /* make a copy */ - newnode = BKE_node_copy_ex(ngroup, node, LIB_ID_COPY_DEFAULT); + newnode = BKE_node_copy_store_new_pointers(ngroup, node, LIB_ID_COPY_DEFAULT); } else { /* use the existing node */ |