Merge branch 'blender-v3.1-release'
This commit is contained in:
commit
e54fba5591
|
@ -570,6 +570,10 @@ class VectorSet {
|
|||
if (this->size() == 0) {
|
||||
try {
|
||||
slots_.reinitialize(total_slots);
|
||||
if (keys_ != nullptr) {
|
||||
this->deallocate_keys_array(keys_);
|
||||
keys_ = nullptr;
|
||||
}
|
||||
keys_ = this->allocate_keys_array(usable_slots);
|
||||
}
|
||||
catch (...) {
|
||||
|
|
|
@ -271,4 +271,14 @@ TEST(vector_set, LookupKey)
|
|||
EXPECT_EQ(set.lookup_key_ptr("a"), set.lookup_key_ptr_as("a"));
|
||||
}
|
||||
|
||||
TEST(vector_set, GrowWhenEmpty)
|
||||
{
|
||||
/* Tests that the internal keys array is freed correctly when growing an empty set. */
|
||||
VectorSet<int> set;
|
||||
set.add(4);
|
||||
set.remove(4);
|
||||
EXPECT_TRUE(set.is_empty());
|
||||
set.reserve(100);
|
||||
}
|
||||
|
||||
} // namespace blender::tests
|
||||
|
|
Loading…
Reference in New Issue