Matteo Bruni : wined3d: Copy the module handle to a local variable in wined3d_cs_run().
Module: wine Branch: master Commit: 6ee7f9074619265d7e3af99ba62fd7e9104ebb96 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6ee7f9074619265d7e3af99ba6... Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Sep 8 18:44:11 2017 +0200 wined3d: Copy the module handle to a local variable in wined3d_cs_run(). Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/cs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 0ff0c61..b3b6588 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2569,11 +2569,16 @@ static DWORD WINAPI wined3d_cs_run(void *ctx) unsigned int spin_count = 0; struct wined3d_cs *cs = ctx; enum wined3d_cs_op opcode; + HMODULE wined3d_module; unsigned int poll = 0; LONG tail; TRACE("Started.\n"); + /* Copy the module handle to a local variable to avoid racing with the + * thread freeing "cs" before the FreeLibraryAndExitThread() call. */ + wined3d_module = cs->wined3d_module; + list_init(&cs->query_poll_list); cs->thread_id = GetCurrentThreadId(); for (;;) @@ -2621,7 +2626,7 @@ static DWORD WINAPI wined3d_cs_run(void *ctx) cs->queue[WINED3D_CS_QUEUE_MAP].tail = cs->queue[WINED3D_CS_QUEUE_MAP].head; cs->queue[WINED3D_CS_QUEUE_DEFAULT].tail = cs->queue[WINED3D_CS_QUEUE_DEFAULT].head; TRACE("Stopped.\n"); - FreeLibraryAndExitThread(cs->wined3d_module, 0); + FreeLibraryAndExitThread(wined3d_module, 0); } struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
participants (1)
-
Alexandre Julliard