From 04250a71f830d4eb8c0658bb66fb3ffb6223240b Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 4 Sep 2023 08:02:03 -0400 Subject: [PATCH] Core/Units: Fixed crash (previously was a memory leak) when vehicle creatures are deleted without ever being added to world Port From (https://github.com/TrinityCore/TrinityCore/commit/40cdf0750d40668692660db817c5fc19d53aea2e) --- Source/Game/Entities/Unit/Unit.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index d69bc666e..02ab8eb3d 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -518,6 +518,12 @@ namespace Game.Entities if (IsInWorld) RemoveFromWorld(); + else + { + // cleanup that must happen even if not in world + if (IsVehicle()) + RemoveVehicleKit(true); + } // A unit may be in removelist and not in world, but it is still in grid // and may have some references during delete