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:
authorSybren A. Stüvel <sybren@blender.org>2020-07-21 15:10:34 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-07-21 15:10:42 +0300
commit5904953d221868ca12b361f7b8f81395440bfb87 (patch)
tree137846ce76b6ce56228817ece418c98139f7189a /source/blender/io/common
parent269c184ac925a9f1bfc7ecefb4cc3c333b51ebb0 (diff)
Tests: IO, fixed a memory leak in the USDHierarchyIteratorTest
No functional changes to Blender.
Diffstat (limited to 'source/blender/io/common')
-rw-r--r--source/blender/io/common/intern/abstract_hierarchy_iterator.cc6
-rw-r--r--source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc1
2 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
index 8c9245ef9b0..8e66c069e18 100644
--- a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
@@ -149,6 +149,12 @@ AbstractHierarchyIterator::AbstractHierarchyIterator(Depsgraph *depsgraph)
AbstractHierarchyIterator::~AbstractHierarchyIterator()
{
+ /* release_writers() cannot be called here directly, as it calls into the pure-virtual
+ * release_writer() function. By the time this destructor is called, the subclass that implements
+ * that pure-virtual function is already destructed. */
+ BLI_assert(
+ writers_.empty() ||
+ !"release_writers() should be called before the AbstractHierarchyIterator goes out of scope");
}
void AbstractHierarchyIterator::iterate_and_write()
diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
index ff073416574..2bc7560e177 100644
--- a/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
+++ b/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc
@@ -71,6 +71,7 @@ class TestingHierarchyIterator : public AbstractHierarchyIterator {
}
virtual ~TestingHierarchyIterator()
{
+ release_writers();
}
protected: