Piotr Caban : oleacc/tests: Fix crash when current thread is not in foreground state.

Alexandre Julliard julliard at winehq.org
Mon Mar 28 15:53:39 CDT 2022


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Sun Mar 27 14:16:31 2022 +0200

oleacc/tests: Fix crash when current thread is not in foreground state.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52079
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleacc/tests/main.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/oleacc/tests/main.c b/dlls/oleacc/tests/main.c
index 85f9a085953..5522867b085 100644
--- a/dlls/oleacc/tests/main.c
+++ b/dlls/oleacc/tests/main.c
@@ -1035,7 +1035,13 @@ static void test_default_client_accessible_object(void)
 
     /* Set the focus to the parent window. */
     ShowWindow(hwnd, SW_SHOW);
-    SetFocus(hwnd);
+    if (!SetForegroundWindow(hwnd))
+    {
+        skip("SetForegroundWindow failed\n");
+        IAccessible_Release(acc);
+        DestroyWindow(hwnd);
+        return;
+    }
     hr = IAccessible_get_accFocus(acc, &v);
     ok(GetFocus() == hwnd, "test window has no focus\n");
     ok(hr == S_OK, "hr %#lx\n", hr);
@@ -1763,6 +1769,12 @@ static void test_default_edit_accessible_object(void)
     check_acc_vals(acc, &edit_acc_vals[1]);
     IAccessible_Release(acc);
 
+    if (!SetForegroundWindow(hwnd))
+    {
+        skip("SetForegroundWindow failed\n");
+        DestroyWindow(hwnd);
+        return;
+    }
     SetFocus(edit[2]);
     hr = CreateStdAccessibleObject(edit[2], OBJID_CLIENT, &IID_IAccessible, (void**)&acc);
     str = SysAllocString(L"edit2-test\r\ntest-edit2\n");




More information about the wine-cvs mailing list