diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-01-07 13:54:31 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-01-07 13:54:31 +0400 |
commit | ebf23b51448e4bc9c67d656093ecc01be882c9d3 (patch) | |
tree | a0c0efdcac7fbb1506b44c7e5674f59f4cd43f5e | |
parent | 54ebaad377e70d1ee0270304fd5d0fda2103c800 (diff) |
Fix T38075, crash from shader node add/replace tree view template.
The sanity check for copying socket default value was using the socket
idname for type compatibility checks, which is too strict. Subtypes
would not be recognized as copyable, but since only the plain data type
is needed below this is all that needs to be checked.
That alone would not cause crash (just missing default value copy),
but the tree view template was messing with the default_value DNA
directly by freeing it in advance, which is not necessary and should
be left to blenkernel when freeing the node. Otherwise this would
leave the node invalid without a default_value if the copy function
bails out.
-rw-r--r-- | source/blender/editors/space_node/node_templates.c | 4 | ||||
-rw-r--r-- | source/blender/nodes/intern/node_socket.c | 2 |
2 files changed, 1 insertions, 5 deletions
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index b544e753965..ac0010b1d55 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -246,10 +246,6 @@ static void node_socket_add_replace(const bContext *C, bNodeTree *ntree, bNode * nodeRemLink(ntree, link); } - if (sock_from->default_value) { - MEM_freeN(sock_from->default_value); - sock_from->default_value = NULL; - } node_socket_copy_default_value(sock_from, sock_prev); } } diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index 92d403685d0..a37042c9d70 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -273,7 +273,7 @@ void node_socket_init_default_value(bNodeSocket *sock) void node_socket_copy_default_value(bNodeSocket *to, bNodeSocket *from) { /* sanity check */ - if (!STREQ(to->idname, from->idname)) + if (to->type != from->type) return; /* make sure both exist */ |