From 8cec8a9892251ed92ec7ad28381339a17d8fcbf5 Mon Sep 17 00:00:00 2001
From: Valentin Radu <valentin.radu@valinet.ro>
Date: Mon, 7 Feb 2022 00:50:43 +0200
Subject: [PATCH] Weather: Terminate host process when widget is disabled

---
 ep_weather_host/ep_weather_host.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ep_weather_host/ep_weather_host.c b/ep_weather_host/ep_weather_host.c
index 5c3b811..2176954 100644
--- a/ep_weather_host/ep_weather_host.c
+++ b/ep_weather_host/ep_weather_host.c
@@ -537,6 +537,8 @@ ULONG STDMETHODCALLTYPE epw_Weather_Release(EPWeather* _this)
         {
         }
 
+        TerminateProcess(GetCurrentProcess(), 0);
+
         return(0);
     }
     return value;
@@ -963,6 +965,7 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
         }
         else if (dwRes == WAIT_ABANDONED_0 + 1 || dwRes == WAIT_OBJECT_0 + 1)
         {
+            if (dwRes == WAIT_OBJECT_0 + 1) ReleaseMutex(_this->hSignalKillSwitch);
             CloseHandle(_this->hSignalKillSwitch);
             TerminateProcess(GetCurrentProcess(), 0);
         }