Fixed valgrind issues.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
208bb097dd
commit
5b1c73a2af
|
@ -39,9 +39,8 @@ namespace CreatureLib::Battling {
|
|||
free(_memory);
|
||||
if (_currentThread != nullptr && _currentThread->joinable()) {
|
||||
_currentThread->join();
|
||||
delete _currentThread;
|
||||
_currentThread = nullptr;
|
||||
}
|
||||
delete _currentThread;
|
||||
}
|
||||
|
||||
size_t GetPosition() const noexcept { return _offset; }
|
||||
|
@ -52,9 +51,9 @@ namespace CreatureLib::Battling {
|
|||
return;
|
||||
if (_currentThread != nullptr && _currentThread->joinable()) {
|
||||
_currentThread->join();
|
||||
delete _currentThread;
|
||||
_currentThread = nullptr;
|
||||
}
|
||||
delete _currentThread;
|
||||
|
||||
if (_offset + sizeof(T) >= _capacity) {
|
||||
_capacity += stepSize;
|
||||
auto newPtr = realloc(_memory, _capacity);
|
||||
|
@ -74,9 +73,9 @@ namespace CreatureLib::Battling {
|
|||
void FinishListening() {
|
||||
if (_currentThread != nullptr && _currentThread->joinable()) {
|
||||
_currentThread->join();
|
||||
delete _currentThread;
|
||||
_currentThread = nullptr;
|
||||
}
|
||||
delete _currentThread;
|
||||
_currentThread = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -41,5 +41,6 @@ TEST_CASE("Build and use event hook with different types", "[Battling]") {
|
|||
eventHook.Trigger<FaintEvent>(nullptr);
|
||||
eventHook.Trigger<DamageEvent>(nullptr, DamageSource::AttackDamage, 0, 0);
|
||||
eventHook.Trigger<FaintEvent>(nullptr);
|
||||
eventHook.FinishListening();
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue