Fixes https://bugs.winehq.org/show_bug.cgi?id=28861
If a context does not exist in the local storage already, it is automatically generated and returned to the application. If the handle is not owned by the process however, 'ImmGetContext()' should return 'NULL'.
Thanks to: Mike Tedder
Signed-off-by: Jimi Huotari chiitoo@gentoo.org --- dlls/imm32/imm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 685eb018c4..46bf5b45c8 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -1509,7 +1509,7 @@ HIMC WINAPI ImmGetContext(HWND hWnd) rc = GetPropW(hWnd,szwWineIMCProperty); if (rc == (HIMC)-1) rc = NULL; - else if (rc == NULL) + else if (rc == NULL && IMM_IsCrossThreadAccess(hWnd, rc)) rc = get_default_context( hWnd );
if (rc)
This is completely inspired by comment 14 in the mentioned bug [1], but I'm unsure if this is a correct use of 'IMM_IsCrossThreadAccess()' at all, and as such, any comments on that will be appreciated!
I imagine it is very possible that this works simply due to the 'else if' not being true due to this change, resulting into 'NULL' just as well as forcing it in some other way.
Thanks!
Jimi Huotari chiitoo@gentoo.org writes:
This is completely inspired by comment 14 in the mentioned bug [1], but I'm unsure if this is a correct use of 'IMM_IsCrossThreadAccess()' at all, and as such, any comments on that will be appreciated!
I imagine it is very possible that this works simply due to the 'else if' not being true due to this change, resulting into 'NULL' just as well as forcing it in some other way.
Yes, the patch would simply force it to NULL always, so it's most likely only hiding the real bug.