From 98f55bfdb1b2ae24797ce3666f51741a693b5d54 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 26 Jan 2021 13:05:00 +0300 Subject: [PATCH] vrclient_x64: Unload native vrclient shared library on process detach. --- vrclient_x64/vrclient_x64/vrclient_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vrclient_x64/vrclient_x64/vrclient_main.c b/vrclient_x64/vrclient_x64/vrclient_main.c index 3a89d87c..dc116ad7 100644 --- a/vrclient_x64/vrclient_x64/vrclient_main.c +++ b/vrclient_x64/vrclient_x64/vrclient_main.c @@ -46,6 +46,8 @@ typedef struct winRenderModel_TextureMap_t_11415 winRenderModel_TextureMap_t_114 WINE_DEFAULT_DEBUG_CHANNEL(vrclient); +static void *vrclient_lib; + BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) { TRACE("(%p, %u, %p)\n", instance, reason, reserved); @@ -55,6 +57,14 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(instance); break; + + case DLL_PROCESS_DETACH: + if (vrclient_lib) + { + dlclose(vrclient_lib); + vrclient_lib = NULL; + } + break; } return TRUE; @@ -215,7 +225,6 @@ static pfn_dtor get_win_destructor(const char *name) return NULL; } -static void *vrclient_lib; static void *(*vrclient_HmdSystemFactory)(const char *name, int *return_code); static void *(*vrclient_VRClientCoreFactory)(const char *name, int *return_code);