Merging r39998 through r40043 from trunk into soc-2011-tomato
[blender-staging.git] / source / blender / blenkernel / intern / node.c
index c7b3a28ecfdc9c7603332b8eee2110825737b366..58fc56d2c731be9d603a6b2d85abacfb5b56b2f6 100644 (file)
@@ -398,6 +398,11 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
                sock->stack_index= 0;
                
                sock->default_value = (oldsock->default_value ? MEM_dupallocN(oldsock->default_value) : NULL);
+               
+               /* XXX some compositor node (e.g. image, render layers) still store
+                * some persistent buffer data here, need to clear this to avoid dangling pointers.
+                */
+               sock->cache = NULL;
        }
        
        BLI_duplicatelist(&nnode->outputs, &node->outputs);
@@ -407,6 +412,11 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
                sock->stack_index= 0;
                
                sock->default_value = (oldsock->default_value ? MEM_dupallocN(oldsock->default_value) : NULL);
+               
+               /* XXX some compositor node (e.g. image, render layers) still store
+                * some persistent buffer data here, need to clear this to avoid dangling pointers.
+                */
+               sock->cache = NULL;
        }
        
        /* don't increase node->id users, freenode doesn't decrement either */