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:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-07-27 11:59:09 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-07-27 11:59:09 +0300
commit5f95ffe35034120189340cd413f24979da92109e (patch)
tree4076f8060cff3b1320c07a1148aa1a52aa292801 /source/blender/gpu
parent3d8c2e25a3af1ea1645f5a6df1b566ae6313e657 (diff)
Fix T48829: Memory leak on Blender Exit
It was possible to have missing outlink but GPUNodes in material.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c6
-rw-r--r--source/blender/gpu/intern/gpu_codegen.h1
-rw-r--r--source/blender/gpu/intern/gpu_material.c3
3 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index aec94f9f2cb..c40bc8eaf27 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1732,3 +1732,9 @@ void GPU_pass_free(GPUPass *pass)
MEM_freeN(pass->vertexcode);
MEM_freeN(pass);
}
+
+void GPU_pass_free_nodes(ListBase *nodes)
+{
+ gpu_nodes_free(nodes);
+}
+
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index 417e46a83ee..7af17f9122d 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -183,6 +183,7 @@ void GPU_pass_update_uniforms(GPUPass *pass);
void GPU_pass_unbind(GPUPass *pass);
void GPU_pass_free(GPUPass *pass);
+void GPU_pass_free_nodes(ListBase *nodes);
void gpu_codegen_init(void);
void gpu_codegen_exit(void);
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 4775d2ed30a..ed9718f1a17 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -270,6 +270,9 @@ static int GPU_material_construct_end(GPUMaterial *material, const char *passnam
material->partangvel = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_ANG_VELOCITY));
return 1;
}
+ else {
+ GPU_pass_free_nodes(&material->nodes);
+ }
return 0;
}