diff options
author | George Hazan <ghazan@miranda.im> | 2021-05-04 20:42:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-05-04 20:42:25 +0300 |
commit | 68c7bf3b55ca132143686ab433659c3b828760aa (patch) | |
tree | 5e2b5f5bc674f05a4c351a8f4f0ea6b6e596ca16 /plugins/Popup | |
parent | ef6ef30fac86de58bfd7d52b1d8a213b8d955d5d (diff) |
attempt to fix some problems on exit
Diffstat (limited to 'plugins/Popup')
-rw-r--r-- | plugins/Popup/src/popup_thread.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index d6fa27d649..76113d68ec 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -210,6 +210,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA static unsigned __stdcall PopupThread(void *)
{
Thread_SetName("Popup: PopupThread");
+ MThreadHandle threadLock(hThread);
// Create manager window
WNDCLASSEX wcl;
@@ -265,9 +266,11 @@ void StopPopupThread() void UnloadPopupThread()
{
- // We won't waint for thread to exit, Miranda's thread unsind mechanism will do that for us.
- WaitForSingleObject(hThread, INFINITE);
- CloseHandle(hThread);
+ // We won't waint for thread to exit, Miranda's thread unwind mechanism will do that for us.
+ if (hThread) {
+ WaitForSingleObject(hThread, INFINITE);
+ CloseHandle(hThread);
+ }
for (auto &it : popupList)
delete it;
|