From 9366a1b4d8038d091c147cb85aeeaaeb46c74aa1 Mon Sep 17 00:00:00 2001 From: Jacob Nevins Date: Sun, 31 Mar 2019 23:47:03 +0100 Subject: [PATCH] Don't call DestroyIcon(INVALID_HANDLE_VALUE). The Windows API documentation doesn't explicitly say this is safe, and ea32967044 didn't take care over it. --- windows/window.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/windows/window.c b/windows/window.c index f5e1214a..9e60f32c 100644 --- a/windows/window.c +++ b/windows/window.c @@ -1665,7 +1665,9 @@ static void init_fonts(int pick_width, int pick_height) ReleaseDC(hwnd, hdc); - DestroyIcon(trust_icon); + if (trust_icon != INVALID_HANDLE_VALUE) { + DestroyIcon(trust_icon); + } trust_icon = LoadImage(hinst, MAKEINTRESOURCE(IDI_MAINICON), IMAGE_ICON, font_width*2, font_height, LR_DEFAULTCOLOR); @@ -1753,7 +1755,9 @@ static void deinit_fonts(void) fontflag[i] = false; } - DestroyIcon(trust_icon); + if (trust_icon != INVALID_HANDLE_VALUE) { + DestroyIcon(trust_icon); + } trust_icon = INVALID_HANDLE_VALUE; }