From 7b3aba8fdc0d66c9fcb540088dc103d7073644c9 Mon Sep 17 00:00:00 2001 From: HMH Date: Fri, 21 Jul 2017 16:02:24 +0200 Subject: [PATCH] fixed memoryleak in CCollision --- src/game/collision.cpp | 10 +++++++++- src/game/collision.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/game/collision.cpp b/src/game/collision.cpp index 331f27c0f..059615252 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -30,9 +30,17 @@ CCollision::CCollision() m_pTune = 0; } +CCollision::~CCollision() +{ + if(m_pLayers) + m_pLayers->Dest(); + Dest(); +} + void CCollision::Init(class CLayers *pLayers) { - if(m_pLayers) m_pLayers->Dest(); + if(m_pLayers) + m_pLayers->Dest(); Dest(); m_NumSwitchers = 0; m_pLayers = pLayers; diff --git a/src/game/collision.h b/src/game/collision.h index 97c3af868..518b3a9c3 100644 --- a/src/game/collision.h +++ b/src/game/collision.h @@ -17,6 +17,7 @@ class CCollision public: CCollision(); + ~CCollision(); void Init(class CLayers *pLayers); bool CheckPoint(float x, float y) { return IsSolid(round_to_int(x), round_to_int(y)); } bool CheckPoint(vec2 Pos) { return CheckPoint(Pos.x, Pos.y); }