From 2d56911e82dfd61891d47673452c403238a9383e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Mon, 12 Mar 2018 09:19:46 +0100 Subject: [PATCH] Sdk/EntityList: Fix copy assignation --- ChangeLog.md | 1 + SDK/include/NDK/EntityList.inl | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index f70b056d1..023f486a3 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -108,6 +108,7 @@ Nazara Development Kit: - World entity ids are now reused from lowest to highest (they were previously reused in reverse order of death) - World now has an internal profiler, allowing to measure the refresh and system update time - CollisionComponent[2D|3D] and PhysicsComponent[2D|3D] now configures their internal RigidBody userdata to the entity ID they belong to (useful for callbacks). +- Fixed EntityList copy/movement assignment operator which was not properly unregistering contained entities. # 0.4: diff --git a/SDK/include/NDK/EntityList.inl b/SDK/include/NDK/EntityList.inl index 4c99aef7a..a34165a68 100644 --- a/SDK/include/NDK/EntityList.inl +++ b/SDK/include/NDK/EntityList.inl @@ -169,6 +169,9 @@ namespace Ndk inline EntityList& EntityList::operator=(const EntityList& entityList) { + for (const Ndk::EntityHandle& entity : *this) + entity->UnregisterEntityList(this); + m_entityBits = entityList.m_entityBits; m_world = entityList.m_world;