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>2012-10-28 21:09:50 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-10-28 21:09:50 +0400
commit5464979dfd4b6723c70660237bcdb5ce3f505a0a (patch)
treebbc3d9792fef07c05abd745813929aa0e1583be4 /source/blender/blenkernel/intern/library.c
parent07d9cb739a3a920d28e1c0bca59d4a86fc80bfca (diff)
Fix for freeing node trees that are part of other data blocks (material, world, lamp, texture, scene). These node trees were not properly freeing the IDProperty data, due to not being called from BKE_libblock_free.
Now there is an extra function BKE_libblock_free_data, which is called explicitly in ntreeFreeTree if the tree is not part of the library data (ntreeCopyTree does a similar thing using BKE_libblock_copy_data).
Diffstat (limited to 'source/blender/blenkernel/intern/library.c')
-rw-r--r--source/blender/blenkernel/intern/library.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 2f5e48e0ac6..942e71b5052 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -796,6 +796,18 @@ static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata
}
}
+void BKE_libblock_free_data(ID *id)
+{
+ Main *bmain = G.main; /* should eventually be an arg */
+
+ if (id->properties) {
+ IDP_FreeProperty(id->properties);
+ MEM_freeN(id->properties);
+ }
+
+ /* this ID may be a driver target! */
+ BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id);
+}
/* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */
void BKE_libblock_free(ListBase *lb, void *idv)
@@ -904,15 +916,9 @@ void BKE_libblock_free(ListBase *lb, void *idv)
break;
}
- if (id->properties) {
- IDP_FreeProperty(id->properties);
- MEM_freeN(id->properties);
- }
-
BLI_remlink(lb, id);
- /* this ID may be a driver target! */
- BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id);
+ BKE_libblock_free_data(id);
MEM_freeN(id);
}