Henri Verbeet : wined3d: Avoid unmapping the module while the CS thread is still running.
Alexandre Julliard
julliard at winehq.org
Thu Apr 20 16:41:31 CDT 2017
Module: wine
Branch: master
Commit: b5d225e4524adc90197ae152946537226965124f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b5d225e4524adc90197ae152946537226965124f
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Wed Apr 19 23:40:50 2017 +0200
wined3d: Avoid unmapping the module while the CS thread is still running.
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/cs.c | 12 +++++++++++-
dlls/wined3d/wined3d_private.h | 1 +
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 43352eb..a579503 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2451,7 +2451,7 @@ static DWORD WINAPI wined3d_cs_run(void *ctx)
queue->tail = queue->head = 0;
TRACE("Stopped.\n");
- return 0;
+ FreeLibraryAndExitThread(cs->wined3d_module, 0);
}
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
@@ -2490,9 +2490,19 @@ struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device)
goto fail;
}
+ if (!(GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ (const WCHAR *)wined3d_cs_run, &cs->wined3d_module)))
+ {
+ ERR("Failed to get wined3d module handle.\n");
+ CloseHandle(cs->event);
+ HeapFree(GetProcessHeap(), 0, cs->data);
+ goto fail;
+ }
+
if (!(cs->thread = CreateThread(NULL, 0, wined3d_cs_run, cs, 0, NULL)))
{
ERR("Failed to create wined3d command stream thread.\n");
+ FreeLibrary(cs->wined3d_module);
CloseHandle(cs->event);
HeapFree(GetProcessHeap(), 0, cs->data);
goto fail;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index cd90eb8..578060a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3253,6 +3253,7 @@ struct wined3d_cs
struct wined3d_device *device;
struct wined3d_fb_state fb;
struct wined3d_state state;
+ HMODULE wined3d_module;
HANDLE thread;
DWORD thread_id;
More information about the wine-cvs
mailing list