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:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-10-29 21:46:01 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-10-29 21:46:01 +0400
commit8bdbbca4858ab143661f371cc302092759e29408 (patch)
treee835ed51d977c07464fe0b4a1a9bfcb6dd0efa27 /source/blender/nodes/intern/node_exec.c
parent8d11abb0ec80a81dbdce1a1a1c163c2e314fb36f (diff)
Fix #37192, Rendered preview causes crash when deleting a material node in shader node editor. The 'free' callback for node execution data was accessed from the node->typeinfo, but this pointer can
become invalid because the render database is not immediately freed after the job finishes. To avoid access to dangling node pointers, store the function callback in the exec data itself. The node pointer must not be accessed in the free function (wasn't used before either), these functions are purely for the execution data.
Diffstat (limited to 'source/blender/nodes/intern/node_exec.c')
-rw-r--r--source/blender/nodes/intern/node_exec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index 812fe5b4ae7..37018b3a98d 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -207,6 +207,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context, bNodeTree *ntree, bNo
/* prepare all nodes for execution */
for (n = 0, nodeexec = exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
node = nodeexec->node = nodelist[n];
+ nodeexec->freeexecfunc = node->typeinfo->freeexecfunc;
/* tag inputs */
for (sock = node->inputs.first; sock; sock = sock->next) {
@@ -245,9 +246,8 @@ void ntree_exec_end(bNodeTreeExec *exec)
MEM_freeN(exec->stack);
for (n = 0, nodeexec = exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
- if (nodeexec->node->typeinfo)
- if (nodeexec->node->typeinfo->freeexecfunc)
- nodeexec->node->typeinfo->freeexecfunc(nodeexec->node, nodeexec->data.data);
+ if (nodeexec->freeexecfunc)
+ nodeexec->freeexecfunc(nodeexec->data.data);
}
if (exec->nodeexec)