Skip to content

Commit 8c24656

Browse files
authored
Merge pull request #1016 from openmultiplayer/hual/player_objects_crash_fix
Fix moving player objects crash due to out-of-order destruction
2 parents 596ece7 + 43cd406 commit 8c24656

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Server/Components/Objects/objects_impl.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,8 @@ class PlayerObjectData final : public IPlayerObjectData
634634
// Decrement the number of player objects using this ID. Once it hits 0 it can become global.
635635
component_.decrementPlayerCounter(obj->getID());
636636
}
637+
// Explicitly clear PlayerObjects to avoid use-after-free when accessing this object from PlayerObject's destructor
638+
storage.clear();
637639
delete this;
638640
}
639641

0 commit comments

Comments
 (0)