Skip to content

Commit

Permalink
fix obj crash, deleted objects being delayed processed
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Oct 10, 2023
1 parent 7b22bb0 commit f35b0f6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Server/Components/Objects/objects_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object*>(ptr)->destream();
obj->destream();
storage.release(index, false);
processedObjects.erase(obj);
attachedToPlayer.erase(obj);
}
}

Expand Down Expand Up @@ -599,6 +601,7 @@ class PlayerObjectData final : public IPlayerObjectData
obj->destream();
storage.release(index, false);
attachedToPlayer_.erase(obj);
component_.getPlayerProcessedObjects().erase(obj);
}
}

Expand Down

0 comments on commit f35b0f6

Please sign in to comment.