diff --git a/Server/Components/Objects/objects_impl.hpp b/Server/Components/Objects/objects_impl.hpp index edb38418f..941f9eed7 100644 --- a/Server/Components/Objects/objects_impl.hpp +++ b/Server/Components/Objects/objects_impl.hpp @@ -381,11 +381,13 @@ class ObjectComponent final : public IObjectsComponent, public CoreEventHandler, void release(int index) override { - auto ptr = storage.get(index); - if (ptr) + auto obj = storage.get(index); + if (obj) { - static_cast(ptr)->destream(); + obj->destream(); storage.release(index, false); + processedObjects.erase(obj); + attachedToPlayer.erase(obj); } } @@ -599,6 +601,7 @@ class PlayerObjectData final : public IPlayerObjectData obj->destream(); storage.release(index, false); attachedToPlayer_.erase(obj); + component_.getPlayerProcessedObjects().erase(obj); } }