[Bf-blender-cvs] [010c51f7389] sybren-usd: Fixed memory leak
Sybren A. Stüvel
noreply at git.blender.org
Thu Nov 21 10:36:17 CET 2019
Commit: 010c51f7389d4501c06f1f8598dd25d60c0417a2
Author: Sybren A. Stüvel
Date: Thu Nov 21 10:22:05 2019 +0100
Branches: sybren-usd
https://developer.blender.org/rB010c51f7389d4501c06f1f8598dd25d60c0417a2
Fixed memory leak
===================================================================
M tests/gtests/blenloader/blendfile_loading_base_test.cc
===================================================================
diff --git a/tests/gtests/blenloader/blendfile_loading_base_test.cc b/tests/gtests/blenloader/blendfile_loading_base_test.cc
index d96b0dd07f4..20c8ee96e7d 100644
--- a/tests/gtests/blenloader/blendfile_loading_base_test.cc
+++ b/tests/gtests/blenloader/blendfile_loading_base_test.cc
@@ -46,6 +46,7 @@ extern "C" {
#include "RNA_define.h"
#include "WM_api.h"
+#include "wm.h"
}
DEFINE_string(test_assets_dir, "", "lib/tests directory from SVN containing the test assets.");
@@ -98,8 +99,6 @@ void BlendfileLoadingBaseTest::TearDownTestCase()
BKE_blender_atexit();
- /* TODO(Sybren): this reports 3 leaked blocks from WM, which have been allocated by loading a
- * blend file. */
if (MEM_get_memory_blocks_in_use() != 0) {
size_t mem_in_use = MEM_get_memory_in_use() + MEM_get_memory_in_use();
printf("Error: Not freed memory blocks: %u, total unfreed memory %f MB\n",
@@ -146,6 +145,11 @@ void BlendfileLoadingBaseTest::blendfile_free()
if (bfile == nullptr) {
return;
}
+
+ wmWindowManager *wm = static_cast<wmWindowManager *>(bfile->main->wm.first);
+ if (wm != nullptr) {
+ wm_close_and_free(NULL, wm);
+ }
BLO_blendfiledata_free(bfile);
bfile = nullptr;
}
More information about the Bf-blender-cvs
mailing list