From 4dcc7a5ae8427b35254713edf1a1a19ce38213f8 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Mon, 7 Feb 2022 00:54:29 -0700 Subject: [PATCH] shell32/tests: Wait for window to close in check_window_exists. This fixes a race condition where the directory is deleted before the window closes, which causes an error dialog to appear. Cutting the number of iterations per wait loop in half is necessary so that doubling the number of wait loops does not result in a timeout when new tests are added. Signed-off-by: Alex Henrie Signed-off-by: Alexandre Julliard --- dlls/shell32/tests/progman_dde.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/shell32/tests/progman_dde.c b/dlls/shell32/tests/progman_dde.c index ef087893016..5d532f9222f 100644 --- a/dlls/shell32/tests/progman_dde.c +++ b/dlls/shell32/tests/progman_dde.c @@ -164,7 +164,7 @@ static BOOL check_window_exists(const char *name) else strcpy(title, name); - for (i = 0; i < 20; i++) + for (i = 0; i < 10; i++) { Sleep(100 * i); if ((window = FindWindowA("ExplorerWClass", title)) || @@ -175,7 +175,17 @@ static BOOL check_window_exists(const char *name) } } - return (window != NULL); + if (!window) + return FALSE; + + for (i = 0; i < 10; i++) + { + Sleep(100 * i); + if (!IsWindow(window)) + break; + } + + return TRUE; } static BOOL check_exists(const char *name)