[PATCH 1/2] shell32/tests: Wait for window to close in check_window_exists

Alex Henrie alexhenrie24 at gmail.com
Mon Feb 7 01:54:29 CST 2022


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 <alexhenrie24 at gmail.com>
---
 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)
-- 
2.35.1




More information about the wine-devel mailing list