[PATCH v2 0/2] MR8031: winex11: Ensure initialized thread data in X11DRV_get_ic.
Intends to replace: https://gitlab.winehq.org/wine/wine-staging/-/blob/master/patches/winex11-im... This patch has been in proton for almost 2 years now, never realized the same code existed upstream, lol -- v2: win32u/tests: Add test for multi-thread NotifyIME. winex11: Ensure initialized thread data in X11DRV_get_ic. https://gitlab.winehq.org/wine/wine/-/merge_requests/8031
From: Etaash Mathamsetty <45927311+Etaash-mathamsetty(a)users.noreply.github.com> --- dlls/winex11.drv/xim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index ef09356fbb0..4c93c73cc23 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -509,7 +509,7 @@ XIC X11DRV_get_ic( HWND hwnd ) XIC ret; if (!(data = get_win_data( hwnd ))) return 0; - x11drv_thread_data()->last_xic_hwnd = hwnd; + x11drv_init_thread_data()->last_xic_hwnd = hwnd; if (!(ret = data->xic) && (xim = x11drv_thread_data()->xim)) ret = data->xic = xic_create( xim, hwnd, data->whole_window ); release_win_data( data ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8031
From: Etaash Mathamsetty <45927311+Etaash-mathamsetty(a)users.noreply.github.com> --- dlls/win32u/tests/win32u.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index acbc5bc3034..41b39f03714 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -2862,6 +2862,33 @@ static void test_NtUserRegisterWindowMessage(void) ok( !wcscmp( buf, L"#0xabc" ), "buf = %s\n", debugstr_w(buf) ); } +static CALLBACK DWORD test_NtUserNotifyIMEStatus_thread(void *user_data) +{ + HWND hwnd = user_data; + + /* validate that the user driver does not crash */ + NtUserNotifyIMEStatus(hwnd, 0); + + return 0; +} + +static void test_NtUserNotifyIMEStatus(void) +{ + HWND hwnd; + HANDLE thread; + + winetest_push_context("notifyime"); + + hwnd = CreateWindowW( L"static", L"static", WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL | WS_CLIPSIBLINGS, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, 0, NULL, 0 ); + thread = CreateThread( NULL, 0, test_NtUserNotifyIMEStatus_thread, hwnd, 0, NULL ); + + WaitForSingleObject(thread, INFINITE); + CloseHandle(thread); + DestroyWindow(hwnd); + + winetest_pop_context(); +} + START_TEST(win32u) { char **argv; @@ -2891,6 +2918,7 @@ START_TEST(win32u) return; } + test_NtUserNotifyIMEStatus(); test_NtUserEnumDisplayDevices(); test_window_props(); test_class(); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8031
On Tue Jun 17 01:44:39 2025 +0000, Etaash Mathamsetty wrote:
Yes, will do added test
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/8031#note_106803
Is that really what the application is doing? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8031#note_106812
On Tue Jun 17 04:15:27 2025 +0000, Elizabeth Figura wrote:
Is that really what the application is doing? Probably not, but it was the easiest way that i could come up with that crashes winex11 but won't crash windows. Maybe the application is doing this exact thing though, I'll have to check
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/8031#note_106813
On Tue Jun 17 04:16:51 2025 +0000, Etaash Mathamsetty wrote:
Probably not, but it was the easiest way that i could come up with that crashes winex11 but won't crash windows. Maybe the application is doing this exact thing though, I'll have to check In fact I'm pretty sure I remember this bug existing even before we had NtUserNotifyIMEStatus().
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/8031#note_107674
participants (3)
-
Elizabeth Figura (@zfigura) -
Etaash Mathamsetty -
Etaash Mathamsetty (@etaash.mathamsetty)