From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/swapchain.c | 53 ++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 32 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index e40707c0e54..4b420a749f3 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -2195,7 +2195,7 @@ struct wined3d_window_state bool set_style; };
-static DWORD WINAPI wined3d_set_window_state(void *ctx) +static DWORD WINAPI set_window_state_thread(void *ctx) { struct wined3d_window_state *s = ctx; bool filter; @@ -2218,12 +2218,28 @@ static DWORD WINAPI wined3d_set_window_state(void *ctx) return 0; }
+static void set_window_state(struct wined3d_window_state *s) +{ + DWORD window_tid = GetWindowThreadProcessId(s->window, NULL); + DWORD tid = GetCurrentThreadId(); + HANDLE thread; + + TRACE("Window %p belongs to thread %#x.\n", s->window, window_tid); + /* If the window belongs to a different thread, modifying the style and/or + * position can potentially deadlock if that thread isn't processing + * messages. */ + if (window_tid == tid) + set_window_state_thread(s); + else if (!(thread = CreateThread(NULL, 0, set_window_state_thread, s, 0, NULL))) + ERR("Failed to create thread.\n"); + else + CloseHandle(thread); +} + HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state *state, HWND window, int x, int y, int width, int height) { struct wined3d_window_state *s; - DWORD window_tid, tid; - HANDLE thread;
TRACE("Setting up window %p for fullscreen mode.\n", window);
@@ -2264,20 +2280,7 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state TRACE("Old style was %08x, %08x, setting to %08x, %08x.\n", state->style, state->exstyle, s->style, s->exstyle);
- window_tid = GetWindowThreadProcessId(window, NULL); - tid = GetCurrentThreadId(); - - TRACE("Window %p belongs to thread %#x.\n", window, window_tid); - /* If the window belongs to a different thread, modifying the style and/or - * position can potentially deadlock if that thread isn't processing - * messages. */ - if (window_tid == tid) - wined3d_set_window_state(s); - else if (!(thread = CreateThread(NULL, 0, wined3d_set_window_state, s, 0, NULL))) - ERR("Failed to create thread.\n"); - else - CloseHandle(thread); - + set_window_state(s); return WINED3D_OK; }
@@ -2285,9 +2288,7 @@ void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_st HWND window, const RECT *window_rect) { struct wined3d_window_state *s; - DWORD window_tid, tid; LONG style, exstyle; - HANDLE thread;
if (!state->style && !state->exstyle) return; @@ -2343,19 +2344,7 @@ void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_st s->flags |= (SWP_NOMOVE | SWP_NOSIZE); }
- window_tid = GetWindowThreadProcessId(window, NULL); - tid = GetCurrentThreadId(); - - TRACE("Window %p belongs to thread %#x.\n", window, window_tid); - /* If the window belongs to a different thread, modifying the style and/or - * position can potentially deadlock if that thread isn't processing - * messages. */ - if (window_tid == tid) - wined3d_set_window_state(s); - else if (!(thread = CreateThread(NULL, 0, wined3d_set_window_state, s, 0, NULL))) - ERR("Failed to create thread.\n"); - else - CloseHandle(thread); + set_window_state(s);
/* Delete the old values. */ state->style = 0;
From: Zebediah Figura zfigura@codeweavers.com
Fixes: a2c03e23565779d2743f5750c37de0be3f7222bf --- dlls/wined3d/swapchain.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 4b420a749f3..346fd1e6497 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -2200,8 +2200,6 @@ static DWORD WINAPI set_window_state_thread(void *ctx) struct wined3d_window_state *s = ctx; bool filter;
- SetThreadDescription(GetCurrentThread(), L"wined3d_set_window_state"); - filter = wined3d_filter_messages(s->window, TRUE);
if (s->set_style) @@ -2229,11 +2227,18 @@ static void set_window_state(struct wined3d_window_state *s) * position can potentially deadlock if that thread isn't processing * messages. */ if (window_tid == tid) + { set_window_state_thread(s); - else if (!(thread = CreateThread(NULL, 0, set_window_state_thread, s, 0, NULL))) - ERR("Failed to create thread.\n"); - else + } + else if ((thread = CreateThread(NULL, 0, set_window_state_thread, s, 0, NULL))) + { + SetThreadDescription(thread, L"wined3d_set_window_state"); CloseHandle(thread); + } + else + { + ERR("Failed to create thread.\n"); + } }
HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state *state,
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125219
Your paranoid android.
=== debian11 (build log) ===
Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24725. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24725. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24725.
This merge request was approved by Jan Sikorski.