From d5e57cf0796d909adb25d09a7363e57a5ff566ca Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Sun, 26 Oct 2025 20:16:29 -0400 Subject: [PATCH] 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 --- echo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/echo.c b/echo.c index 355005d..7a1ccfe 100644 --- a/echo.c +++ b/echo.c @@ -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;