Skip to content

Commit 5731e94

Browse files
committed
test: try to reproduce a crash with reentrant destructors and asan enabled
1 parent 2eaa4e8 commit 5731e94

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎test/entt/entity/storage.cpp‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,6 +1772,26 @@ TEST(Storage, UpdateFromDestructor) {
17721772
}
17731773
}
17741774

1775+
TEST(Storage, UpdateFromDestructorOnDestroy) {
1776+
using entity_type = StorageBase::my_entity;
1777+
1778+
constexpr auto size = 10u;
1779+
const std::array entity{entity_type{4u}, entity_type{2u}, entity_type{0u}};
1780+
1781+
for(auto target: entity) {
1782+
entt::basic_storage<StorageBase::update_from_destructor, entity_type> pool;
1783+
1784+
for(std::size_t next{}; next < size; ++next) {
1785+
const auto other = entity_type(next);
1786+
pool.emplace(other, pool, other == entity_type(size / 2) ? target : other);
1787+
}
1788+
1789+
pool.erase(entity_type(size / 2));
1790+
1791+
// the storage goes out of scope here
1792+
}
1793+
}
1794+
17751795
TEST(Storage, CreateFromConstructor) {
17761796
using entity_type = StorageBase::my_entity;
17771797

0 commit comments

Comments
 (0)