Skip to content

Commit

Permalink
Merge pull request #1016 from openmultiplayer/hual/player_objects_cra…
Browse files Browse the repository at this point in the history
…sh_fix

Fix moving player objects crash due to out-of-order destruction
  • Loading branch information
AmyrAhmady authored Oct 31, 2024
2 parents 596ece7 + 43cd406 commit 8c24656
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Server/Components/Objects/objects_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@ class PlayerObjectData final : public IPlayerObjectData
// Decrement the number of player objects using this ID. Once it hits 0 it can become global.
component_.decrementPlayerCounter(obj->getID());
}
// Explicitly clear PlayerObjects to avoid use-after-free when accessing this object from PlayerObject's destructor
storage.clear();
delete this;
}

Expand Down

0 comments on commit 8c24656

Please sign in to comment.