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:
authorJeroen Bakker <jeroen@blender.org>2020-09-08 11:40:30 +0300
committerJeroen Bakker <jeroen@blender.org>2020-09-08 14:23:04 +0300
commit0d68f55789aff106bdf9e038812d358ca55c060f (patch)
tree7f7f6d32f7a8de24106ac51e5e686f305274247f
parent489aeabb9e500ab852a42e73b4e19cf1e80c62ba (diff)
DrawManager: Fixed memory leak in test cases
Memory leak is introduced as test cases reinitializes the GPU stack. Added a call to GPU_backend_exit to fix this. In GPU_backend_exit the GPU backend was destroyed but the pointer wasn't reset for reuse. This patch also clears the pointer to be reused.
-rw-r--r--source/blender/draw/tests/shaders_test.cc1
-rw-r--r--source/blender/gpu/intern/gpu_context.cc1
2 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/draw/tests/shaders_test.cc b/source/blender/draw/tests/shaders_test.cc
index eb7a37711e6..95474dad8b8 100644
--- a/source/blender/draw/tests/shaders_test.cc
+++ b/source/blender/draw/tests/shaders_test.cc
@@ -37,6 +37,7 @@ class DrawTest : public ::testing::Test {
void TearDown() override
{
GPU_exit();
+ GPU_backend_exit();
GPU_context_discard(context);
GHOST_DisposeOpenGLContext(ghost_system, ghost_context);
GHOST_DisposeSystem(ghost_system);
diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc
index 188225b3eed..119c1ef9c55 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -185,6 +185,7 @@ void GPU_backend_exit(void)
/* TODO assert no resource left. Currently UI textures are still not freed in their context
* correctly. */
delete g_backend;
+ g_backend = NULL;
}
GPUBackend *GPUBackend::get(void)