summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-05-24 19:14:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-05-24 19:14:44 +0300
commitd46738ce43184a2ca07e00a77859f17698713645 (patch)
tree486d0ff4f52ae4e7b5e5422c98f97f795636caa1 /src
parent4079728d6be6bb67379386019bba30683637f050 (diff)
fixes #3076 (Toaster: crash when loading "on the fly")
Diffstat (limited to 'src')
-rw-r--r--src/core/stdpopup/src/message_pump.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/core/stdpopup/src/message_pump.cpp b/src/core/stdpopup/src/message_pump.cpp
index 0b7fe9f519..9afca31246 100644
--- a/src/core/stdpopup/src/message_pump.cpp
+++ b/src/core/stdpopup/src/message_pump.cpp
@@ -1,19 +1,16 @@
#include "stdafx.h"
-unsigned message_pump_thread_id = 0;
-int num_popups = 0;
+static int num_popups = 0;
-HANDLE hMPEvent;
+static HANDLE hMPThread;
+unsigned message_pump_thread_id = 0;
#define MUM_FINDWINDOW (WM_USER + 0x050)
#define MAX_POPUPS 100
-unsigned __stdcall MessagePumpThread(void *param)
+unsigned __stdcall MessagePumpThread(void *)
{
- if (param)
- SetEvent((HANDLE)param);
-
MSG hwndMsg = {};
while (GetMessage(&hwndMsg, nullptr, 0, 0) > 0 && !bShutdown) {
if (hwndMsg.hwnd != nullptr && IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) /* Wine fix. */
@@ -88,13 +85,13 @@ void InitMessagePump()
InitServices();
- hMPEvent = CreateEvent(nullptr, TRUE, 0, nullptr);
- CloseHandle(mir_forkthreadex(MessagePumpThread, hMPEvent, &message_pump_thread_id));
- WaitForSingleObject(hMPEvent, INFINITE);
- CloseHandle(hMPEvent);
+ hMPThread = mir_forkthreadex(MessagePumpThread, 0, &message_pump_thread_id);
}
void DeinitMessagePump()
{
PostMPMessage(WM_QUIT, 0, 0);
+
+ WaitForSingleObject(hMPThread, INFINITE);
+ CloseHandle(hMPThread);
}