Module: wine Branch: master Commit: 9bcc90fb4bc81da21fc70e27e538c4349c7da388 URL: https://gitlab.winehq.org/wine/wine/-/commit/9bcc90fb4bc81da21fc70e27e538c43...
Author: Paul Gofman pgofman@codeweavers.com Date: Fri Feb 3 20:15:48 2023 -0600
imm32: Disable cross thread access for ImmSetCompositionString().
---
dlls/imm32/imm.c | 6 ++++++ dlls/imm32/tests/imm32.c | 8 ++++++++ 2 files changed, 14 insertions(+)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index fa2e0705db1..17061ae0034 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2377,6 +2377,9 @@ BOOL WINAPI ImmSetCompositionStringA( if (!data) return FALSE;
+ if (IMM_IsCrossThreadAccess(NULL, hIMC)) + return FALSE; + if (!(dwIndex == SCS_SETSTR || dwIndex == SCS_CHANGEATTR || dwIndex == SCS_CHANGECLAUSE || @@ -2432,6 +2435,9 @@ BOOL WINAPI ImmSetCompositionStringW( if (!data) return FALSE;
+ if (IMM_IsCrossThreadAccess(NULL, hIMC)) + return FALSE; + if (!(dwIndex == SCS_SETSTR || dwIndex == SCS_CHANGEATTR || dwIndex == SCS_CHANGECLAUSE || diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index 75b5cde6c7b..496dc284fbc 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -984,6 +984,14 @@ static void test_ImmThreads(void) rc = ImmSetCompositionFontA(threadinfo.u_himc, &lf); ok(rc == 0, "ImmSetCompositionFont should fail\n");
+ /* CompositionString */ + rc = ImmSetCompositionStringA(himc, SCS_SETSTR, "a", 2, NULL, 0); + ok(rc, "failed.\n"); + rc = ImmSetCompositionStringA(otherHimc, SCS_SETSTR, "a", 2, NULL, 0); + ok(!rc, "should fail.\n"); + rc = ImmSetCompositionStringA(threadinfo.u_himc, SCS_SETSTR, "a", 2, NULL, 0); + ok(!rc, "should fail.\n"); + /* CompositionWindow */ rc = ImmSetCompositionWindow(himc, &cf); ok(rc != 0, "ImmSetCompositionWindow failed\n");