Avoid blocking calls during WM_OVPN_ECHOMSG processing

We send this message from the connection thread to the main
thread using a blocking SendMesssage as the echo message to display is
cleared soon after. This sometimes leads to timeouts (and
thus long waits). Avoid timeout using Async ShowWindow() and delaying
SetForegroundWindow() as these could otherwise wait if the current
foreground Window is controlled by the calling thread.

Signed-off-by: Selva Nair <selva.nair@gmail.com>
master
Selva Nair 2025-10-26 20:16:29 -04:00 committed by Lev Stipakov
parent 700fdd315f
commit d5e57cf079
1 changed files with 5 additions and 2 deletions

7
echo.c
View File

@ -292,6 +292,10 @@ echo_msg_display(connection_t *c, time_t timestamp, const char *title, int type)
{
WriteStatusLog(c, L"GUI> Failed to display echo message: ", c->echo_msg.title, false);
}
else if (echo_msg_window)
{
SetForegroundWindow(echo_msg_window);
}
}
else /* notify */
{
@ -610,8 +614,7 @@ MessageDialogFunc(HWND hwnd, UINT msg, UNUSED WPARAM wParam, LPARAM lParam)
}
AddMessageBoxText(hwnd, c->echo_msg.text, c->echo_msg.title, from);
SetForegroundWindow(hwnd);
ShowWindow(hwnd, SW_SHOW);
ShowWindowAsync(hwnd, SW_SHOW);
}
break;