diff --git a/amxmodx/CTask.cpp b/amxmodx/CTask.cpp index 442dc86c..ccdd48dd 100755 --- a/amxmodx/CTask.cpp +++ b/amxmodx/CTask.cpp @@ -162,6 +162,11 @@ CTaskMngr::CTaskMngr() m_pTmr_TimeLeft = NULL; } +CTaskMngr::~CTaskMngr() +{ + clear(); +} + void CTaskMngr::registerTimers(float *pCurrentTime, float *pTimeLimit, float *pTimeLeft) { m_pTmr_CurrentTime = pCurrentTime; @@ -235,5 +240,8 @@ void CTaskMngr::startFrame() void CTaskMngr::clear() { + for (TaskListIter iter = m_Tasks.begin(); iter; ++iter) + delete &(*iter); // hamster + m_Tasks.clear(); } diff --git a/amxmodx/CTask.h b/amxmodx/CTask.h index fa87b0fc..94d59a10 100755 --- a/amxmodx/CTask.h +++ b/amxmodx/CTask.h @@ -106,6 +106,7 @@ private: float *m_pTmr_TimeLeft; public: CTaskMngr(); + ~CTaskMngr(); void registerTimers(float *pCurrentTime, float *pTimeLimit, float *pTimeLeft); // The timers will always point to the right value void registerTask(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat);