diff --git a/sources/Players/Events/PlayerAPI_OnNewPlayer_Signal.uc b/sources/Players/Events/PlayerAPI_OnNewPlayer_Signal.uc index 02efbca..5714ae2 100644 --- a/sources/Players/Events/PlayerAPI_OnNewPlayer_Signal.uc +++ b/sources/Players/Events/PlayerAPI_OnNewPlayer_Signal.uc @@ -26,7 +26,7 @@ public final function Emit(EPlayer newPlayer) nextSlot = GetNextSlot(); while (nextSlot != none) { - PlayerAPI_OnNewPlayer_Slot(nextSlot).connect(EPlayer(newPlayer.Copy())); + PlayerAPI_OnNewPlayer_Slot(nextSlot).connect(newPlayer); nextSlot = GetNextSlot(); } CleanEmptySlots(); diff --git a/sources/Players/PlayersAPI.uc b/sources/Players/PlayersAPI.uc index 2fa7f18..0ea4e6c 100644 --- a/sources/Players/PlayersAPI.uc +++ b/sources/Players/PlayersAPI.uc @@ -72,8 +72,6 @@ protected function Finalizer() * void (EPlayer newPlayer) * * @param handle Base `EPlayer` interface for the newly connected player. - * Each handler will receive its own copy of `EPlayer` that has to - * be deallocated. */ /* SIGNAL */ public function PlayerAPI_OnNewPlayer_Slot OnNewPlayer( @@ -93,7 +91,7 @@ public function PlayerAPI_OnNewPlayer_Slot OnNewPlayer( * the disconnected player. */ /* SIGNAL */ -public function PlayerAPI_OnLostPlayer_Slot OnLostPlayerHandle( +public function PlayerAPI_OnLostPlayer_Slot OnLostPlayer( AcediaObject receiver) { ConnectToConnectionService(); @@ -185,10 +183,10 @@ private final function ConnectToConnectionService() private final function AnnounceNewPlayer( ConnectionService.Connection newConnection) { - if (onNewPlayerSignal == none) { - return; - } - onNewPlayerSignal.Emit(FromController(newConnection.controllerReference)); + local EPlayer newPlayer; + newPlayer = FromController(newConnection.controllerReference); + onNewPlayerSignal.Emit(newPlayer); + _.memory.Free(newPlayer); } private final function AnnounceLostPlayer(