fixed timer cleanup

This commit is contained in:
henrypp committed 2019-04-15 15:25:30 +06:00
1 parent d6ab0551be
commit c1855d96a1
1 file changed
+9 -7
+9 -7
View File
@@ -3,7 +3,7 @@
#include "global.hpp"
void _app_timer_create (HWND hwnd, const MFILTER_APPS* ptr_apps, time_t seconds)
void _app_timer_create (HWND hwnd, const MFILTER_APPS *ptr_apps, time_t seconds)
{
if (!config.hengine || !ptr_apps || ptr_apps->empty ())
return;
@@ -19,8 +19,8 @@ void _app_timer_create (HWND hwnd, const MFILTER_APPS* ptr_apps, time_t seconds)
if (ptr_app->htimer)
{
DeleteTimerQueueTimer (config.htimer, ptr_app->htimer, nullptr);
ptr_app->htimer = nullptr;
if (DeleteTimerQueueTimer (config.htimer, ptr_app->htimer, nullptr))
ptr_app->htimer = nullptr;
}
if (ptr_app->timer)
@@ -50,7 +50,7 @@ void _app_timer_create (HWND hwnd, const MFILTER_APPS* ptr_apps, time_t seconds)
_wfp_create3filters (ptr_apps, __LINE__);
}
size_t _app_timer_remove (HWND hwnd, const MFILTER_APPS* ptr_apps)
size_t _app_timer_remove (HWND hwnd, const MFILTER_APPS *ptr_apps)
{
if (!config.hengine || !ptr_apps || ptr_apps->empty ())
return false;
@@ -72,9 +72,11 @@ size_t _app_timer_remove (HWND hwnd, const MFILTER_APPS* ptr_apps)
if (ptr_app->htimer)
{
DeleteTimerQueueTimer (config.htimer, ptr_app->htimer, nullptr);
ptr_app->htimer = nullptr;
ptr_app->timer = 0;
if (DeleteTimerQueueTimer (config.htimer, ptr_app->htimer, nullptr))
{
ptr_app->htimer = nullptr;
ptr_app->timer = 0;
}
ptr_app->is_enabled = false;