Alex Henrie : shell32/tests: Wait for window to close in check_window_exists.

Alexandre Julliard julliard at winehq.org
Wed Feb 9 16:03:49 CST 2022


Module: wine
Branch: master
Commit: 4dcc7a5ae8427b35254713edf1a1a19ce38213f8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4dcc7a5ae8427b35254713edf1a1a19ce38213f8

Author: Alex Henrie <alexhenrie24 at gmail.com>
Date:   Mon Feb  7 00:54:29 2022 -0700

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 <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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)




More information about the wine-cvs mailing list