[Bf-blender-cvs] [f14cbc0d077] blender2.8: Material: Free gpumaterials before the notree.
Clément Foucault
noreply at git.blender.org
Tue Mar 6 16:45:35 CET 2018
Commit: f14cbc0d0773d33f917c75f84b25dbc1e48a2976
Author: Clément Foucault
Date: Mon Mar 5 00:52:19 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBf14cbc0d0773d33f917c75f84b25dbc1e48a2976
Material: Free gpumaterials before the notree.
This is because gpumaterials can contain references to the tree when doing lazy compilation.
===================================================================
M source/blender/blenkernel/intern/material.c
===================================================================
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 0117cfcc022..87a57e2973a 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -98,6 +98,9 @@ void BKE_material_free(Material *ma)
MEM_SAFE_FREE(ma->ramp_col);
MEM_SAFE_FREE(ma->ramp_spec);
+
+ /* Free gpu material before the ntree */
+ GPU_material_free(&ma->gpumaterial);
/* is no lib link block, but material extension */
if (ma->nodetree) {
@@ -108,8 +111,6 @@ void BKE_material_free(Material *ma)
MEM_SAFE_FREE(ma->texpaintslot);
- GPU_material_free(&ma->gpumaterial);
-
BKE_icon_id_delete((ID *)ma);
BKE_previewimg_free(&ma->preview);
}
@@ -1709,13 +1710,14 @@ void paste_matcopybuf(Material *ma)
MEM_freeN(mtex);
}
+ /* Free gpu material before the ntree */
+ GPU_material_free(&ma->gpumaterial);
+
if (ma->nodetree) {
ntreeFreeTree(ma->nodetree);
MEM_freeN(ma->nodetree);
}
- GPU_material_free(&ma->gpumaterial);
-
id = (ma->id);
memcpy(ma, &matcopybuf, sizeof(Material));
(ma->id) = id;
More information about the Bf-blender-cvs
mailing list