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-14 12:03:55 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-10-14 12:03:55 +0400
commita90b8ebe48a767b95b9c867518b9b60f9624a5d2 (patch)
tree9f399ea17c5e83f5f93cf89fa81e904d1d83c0ae /source/blender/blenkernel/intern/node.c
parentdfea1dd0d7c2d188a5b29ca9cb883d943aa75086 (diff)
Fix for crash from double-freeing in nodes:
The way node groups check for localized trees in the ntreeFreeTree_ex function does not work. When the main library is freed on exit it also frees genuine node groups trees (which is correct), but then node groups referencing these trees will not find them in the library and interpret that as a localized group, attempting to free them a second time ... Nicer solution is to just use a special flag on localized node trees so we can clearly distinguish them from genuine trees in main.
Diffstat (limited to 'source/blender/blenkernel/intern/node.c')
-rw-r--r--source/blender/blenkernel/intern/node.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 6e2780b48f4..cc4263f4392 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1672,8 +1672,8 @@ static void free_localized_node_groups(bNodeTree *ntree)
for (node = ntree->nodes.first; node; node = node->next) {
if (node->type == NODE_GROUP && node->id) {
bNodeTree *ngroup = (bNodeTree *)node->id;
- if (BLI_findindex(&G.main->nodetree, ngroup) == -1) {
- /* ntree is not in library, i.e. localized node group: free it */
+ if (ngroup->flag & NTREE_IS_LOCALIZED) {
+ /* ntree is a localized copy: free it */
ntreeFreeTree_ex(ngroup, false);
MEM_freeN(ngroup);
}
@@ -1960,6 +1960,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
* Note: previews are not copied here.
*/
ltree = ntreeCopyTree_internal(ntree, NULL, FALSE, FALSE, FALSE);
+ ltree->flag |= NTREE_IS_LOCALIZED;
for (node = ltree->nodes.first; node; node = node->next) {
if (node->type == NODE_GROUP && node->id) {