From c7a1e115b5071ae55db4aa66085d19c183ea325d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 16 Nov 2021 12:47:14 +0100 Subject: Tests: fix memory leak of GHOST system paths Dispose of GHOST system paths when tearing down `BlendfileLoadingBaseTest` and some other test cases. This prevents a memory leak. A better solution would be to rework Blender's initialisation & teardown structure, but that's outside the scope of this fix. No functional changes to Blender. --- source/blender/blenkernel/intern/layer_test.cc | 4 ++++ source/blender/blenloader/CMakeLists.txt | 1 + source/blender/blenloader/tests/blendfile_loading_base_test.cc | 3 +++ 3 files changed, 8 insertions(+) (limited to 'source') diff --git a/source/blender/blenkernel/intern/layer_test.cc b/source/blender/blenkernel/intern/layer_test.cc index b5f800dd181..c8e5de75bfa 100644 --- a/source/blender/blenkernel/intern/layer_test.cc +++ b/source/blender/blenkernel/intern/layer_test.cc @@ -33,6 +33,8 @@ #include "RNA_access.h" +#include "GHOST_Path-api.h" + namespace blender::bke::tests { TEST(view_layer, aov_unique_names) @@ -94,6 +96,7 @@ TEST(view_layer, aov_unique_names) IMB_exit(); BKE_appdir_exit(); CLG_exit(); + GHOST_DisposeSystemPaths(); } static void test_render_pass_conflict(Scene *scene, @@ -173,6 +176,7 @@ TEST(view_layer, aov_conflict) IMB_exit(); BKE_appdir_exit(); CLG_exit(); + GHOST_DisposeSystemPaths(); } } // namespace blender::bke::tests diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index 89631588ed0..b3df5c8aa67 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -34,6 +34,7 @@ set(INC ../sequencer ../windowmanager ../../../intern/clog + ../../../intern/ghost ../../../intern/guardedalloc # for writefile.c: dna_type_offsets.h diff --git a/source/blender/blenloader/tests/blendfile_loading_base_test.cc b/source/blender/blenloader/tests/blendfile_loading_base_test.cc index 8afa631ffc5..21156868655 100644 --- a/source/blender/blenloader/tests/blendfile_loading_base_test.cc +++ b/source/blender/blenloader/tests/blendfile_loading_base_test.cc @@ -48,6 +48,8 @@ #include "WM_api.h" #include "wm.h" +#include "GHOST_Path-api.h" + #include "CLG_log.h" void BlendfileLoadingBaseTest::SetUpTestCase() @@ -93,6 +95,7 @@ void BlendfileLoadingBaseTest::TearDownTestCase() RNA_exit(); DEG_free_node_types(); + GHOST_DisposeSystemPaths(); DNA_sdna_current_free(); BLI_threadapi_exit(); -- cgit v1.2.3