Call the node freestorage callback _before_ actually freeing sockets, since this...
authorLukas Toenne <lukas.toenne@googlemail.com>
Thu, 1 Mar 2012 12:07:59 +0000 (12:07 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Thu, 1 Mar 2012 12:07:59 +0000 (12:07 +0000)
source/blender/blenkernel/intern/node.c

index 99edd4b..ba25bee 100644 (file)
@@ -903,12 +903,15 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node)
        node_unlink_attached(ntree, node);
        
        BLI_remlink(&ntree->nodes, node);
-
+       
        /* since it is called while free database, node->id is undefined */
        
        if (treetype->free_node_cache)
                treetype->free_node_cache(ntree, node);
        
+       if(node->typeinfo && node->typeinfo->freestoragefunc)
+               node->typeinfo->freestoragefunc(node);
+       
        for (sock=node->inputs.first; sock; sock = nextsock) {
                nextsock = sock->next;
                node_socket_free_default_value(sock->type, sock->default_value);
@@ -922,10 +925,6 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node)
 
        nodeFreePreview(node);
 
-       if(node->typeinfo && node->typeinfo->freestoragefunc) {
-               node->typeinfo->freestoragefunc(node);
-       }
-
        MEM_freeN(node);
        
        ntree->update |= NTREE_UPDATE_NODES;