From 7354c835e6e18a8b064da1939f44c3aa59fbee09 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 23 Oct 2021 18:38:12 +0200 Subject: [PATCH] Fixes memory leak. Signed-off-by: Deukhoofd --- src/Battling/Models/Battle.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Battling/Models/Battle.hpp b/src/Battling/Models/Battle.hpp index eed2aa8..a7608af 100644 --- a/src/Battling/Models/Battle.hpp +++ b/src/Battling/Models/Battle.hpp @@ -26,7 +26,7 @@ namespace CreatureLib::Battling { bool _hasEnded = false; BattleResult _battleResult = BattleResult::Empty(); EventHook _eventHook; - HistoryHolder* _historyHolder = new HistoryHolder(); + ArbUt::UniquePtr _historyHolder = new HistoryHolder(); uint32_t _currentTurn = 0; @@ -115,7 +115,7 @@ namespace CreatureLib::Battling { try_creature(this->_historyHolder->Register(this->GetCurrentTurn(), args...); , "Exception occurred during history element registration."); } - const HistoryHolder* GetHistory() const noexcept { return _historyHolder; } + const HistoryHolder* GetHistory() const noexcept { return _historyHolder.GetRaw(); } long GetLastTurnTimeMicroseconds() const noexcept { return _lastTurnTime; }