From ba127ef7b28d9b8f768b40bfd71f92e26055568d Mon Sep 17 00:00:00 2001 From: Lynix Date: Tue, 24 Feb 2015 16:15:17 +0100 Subject: [PATCH] (Entity) Fixed handles not being cleared after destruction Also updated some comments Former-commit-id: 86b23fca0806c637fbe007df4c7edfb52b95f8e1 --- SDK/include/NDK/EntityHandle.inl | 4 ++-- SDK/src/NDK/Entity.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/SDK/include/NDK/EntityHandle.inl b/SDK/include/NDK/EntityHandle.inl index 31a6b7d61..6afdb2b0c 100644 --- a/SDK/include/NDK/EntityHandle.inl +++ b/SDK/include/NDK/EntityHandle.inl @@ -46,13 +46,13 @@ namespace Ndk inline void EntityHandle::Reset(Entity* entity) { - // Si nous avions déjà une entité, nous devons l'informer que nous ne pointons plus vers elle + // Si nous avions déjà une entité, nous devons l'informer que nous ne pointons plus sur elle if (m_entity) m_entity->UnregisterHandle(this); m_entity = entity; if (m_entity) - // On informe la nouvelle entité que nous pointons vers elle + // On informe la nouvelle entité que nous pointons sur elle m_entity->RegisterHandle(this); } diff --git a/SDK/src/NDK/Entity.cpp b/SDK/src/NDK/Entity.cpp index d407a7778..47efff9e2 100644 --- a/SDK/src/NDK/Entity.cpp +++ b/SDK/src/NDK/Entity.cpp @@ -48,5 +48,7 @@ namespace Ndk // On informe chaque handle de notre destruction pour éviter qu'il ne continue de pointer sur nous for (EntityHandle* handle : m_handles) handle->OnEntityDestroyed(); + + m_handles.clear(); } }