From cbc671947a3baca3da7d6c5a2980a86b7f6a7055 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Aug 2021 16:56:11 +1000 Subject: Fix T88033: Python reference memory leaks for non main data-blocks ID data-blocks that could be accessed from Python and weren't freed using BKE_id_free_ex did not release the Python reference count. Add BKE_libblock_free_data_py function to clear the Python reference in this case. Add asserts to ensure no Python reference is held in situations when ID's are copied for internal use (not exposed through the RNA API), to ensure these kinds of leaks don't go by unnoticed again. --- source/blender/gpu/intern/gpu_material.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/gpu/intern/gpu_material.c') diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 37089785e0e..56e72fbeca9 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -758,6 +758,7 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene, /* Only free after GPU_pass_shader_get where GPUUniformBuf * read data from the local tree. */ ntreeFreeLocalTree(localtree); + BLI_assert(!localtree->id.py_instance); /* Or call #BKE_libblock_free_data_py. */ MEM_freeN(localtree); /* note that even if building the shader fails in some way, we still keep -- cgit v1.2.3