From 3cf0257f346343b022b8e7c764118dab4117c8cb Mon Sep 17 00:00:00 2001 From: Quantum Date: Thu, 22 Jul 2021 06:13:43 -0400 Subject: [PATCH] [host] windows: do not complain about failed timer destruction at exit When our window is destroyed, our timers are also destroyed. This causes our attempt at destruction to fail. Instead, set MessageHWND to NULL in the WM_DESTROY handler and don't try destroying the timers if the window is gone. --- common/src/platform/windows/time.c | 2 +- host/platform/Windows/src/platform.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/platform/windows/time.c b/common/src/platform/windows/time.c index 3a46ab45..09dc2fc7 100644 --- a/common/src/platform/windows/time.c +++ b/common/src/platform/windows/time.c @@ -65,7 +65,7 @@ void lgTimerDestroy(LGTimer * timer) { if (timer->running) { - if (!KillTimer(MessageHWND, timer->handle)) + if (MessageHWND && !KillTimer(MessageHWND, timer->handle)) DEBUG_ERROR("failed to destroy the timer"); } diff --git a/host/platform/Windows/src/platform.c b/host/platform/Windows/src/platform.c index 8d6ee690..295f33e1 100644 --- a/host/platform/Windows/src/platform.c +++ b/host/platform/Windows/src/platform.c @@ -205,6 +205,7 @@ LRESULT CALLBACK DummyWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { case WM_DESTROY: Shell_NotifyIcon(NIM_DELETE, &app.iconData); + MessageHWND = NULL; PostQuitMessage(0); break;