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>2011-04-23 11:21:10 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2011-04-23 11:21:10 +0400
commit6b4cecc4662f6f7e5c99f1bf2b1706771c37a00b (patch)
treedf65a5bdbf938b5437cef75781967be4f92321f6 /source/blender/blenkernel/intern
parent25974319db3f3622bd29306da38e3cfdd4911801 (diff)
Fix for group output memory leak, bug #27104. This happens when an internal node in a group has multiple output buffers, but only some of them are used. Then all the buffers would be created, but the unlinked outputs were not correctly tagged for freeing after group execution.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/node.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 18268d72609..fed982a8f1d 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1997,11 +1997,23 @@ static void node_group_execute(bNodeStack *stack, void *data, bNode *gnode, bNod
if (ntree->type==NTREE_COMPOSIT) {
bNodeSocket *sock;
bNodeStack *ns;
+
+ /* clear hasoutput on all local stack data,
+ * only the group output will be used from now on
+ */
+ for (node=ntree->nodes.first; node; node=node->next) {
+ for (sock=node->outputs.first; sock; sock=sock->next) {
+ if (sock->stack_type==SOCK_STACK_LOCAL) {
+ ns= get_socket_stack(stack, sock, in);
+ ns->hasoutput = 0;
+ }
+ }
+ }
+ /* use the hasoutput flag to tag external sockets */
for (sock=ntree->outputs.first; sock; sock=sock->next) {
- /* use the hasoutput flag to tag external sockets */
if (sock->stack_type==SOCK_STACK_LOCAL) {
ns= get_socket_stack(stack, sock, in);
- ns->hasoutput = 0;
+ ns->hasoutput = 1;
}
}
/* now free all stacks that are not used from outside */
@@ -2009,11 +2021,9 @@ static void node_group_execute(bNodeStack *stack, void *data, bNode *gnode, bNod
for (sock=node->outputs.first; sock; sock=sock->next) {
if (sock->stack_type==SOCK_STACK_LOCAL ) {
ns= get_socket_stack(stack, sock, in);
- if (ns->hasoutput!=0 && ns->data) {
+ if (ns->hasoutput==0 && ns->data) {
free_compbuf(ns->data);
ns->data = NULL;
- /* reset the flag */
- ns->hasoutput = 1;
}
}
}