From 5d57ef328f72d9a1b56d192233b31f16473e5ad1 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 30 Mar 2021 20:27:10 +0300 Subject: [PATCH] vrclient: Cleanup vrclient before native library unload if the app failed to do so. Unloading native library without the cleanup hangs. If the native library is not unloaded explicitly the Linux process then hangs on exit. Fixes hang on exit from Doom VFR. Signed-off-by: Paul Gofman --- vrclient_x64/vrclient_x64/vrclient_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vrclient_x64/vrclient_x64/vrclient_main.c b/vrclient_x64/vrclient_x64/vrclient_main.c index 566594dd..dc7568af 100644 --- a/vrclient_x64/vrclient_x64/vrclient_main.c +++ b/vrclient_x64/vrclient_x64/vrclient_main.c @@ -58,6 +58,7 @@ static struct IDXGIVkInteropDevice *dxvk_device; #endif BOOL d3d11_explicit_handoff, handoff_called; + void *client_core_linux_side; } compositor_data; @@ -74,6 +75,11 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) case DLL_PROCESS_DETACH: if (vrclient_lib) { + if (compositor_data.client_core_linux_side) + { + cppIVRClientCore_IVRClientCore_003_Cleanup(compositor_data.client_core_linux_side); + compositor_data.client_core_linux_side = NULL; + } dlclose(vrclient_lib); vrclient_lib = NULL; } @@ -386,6 +392,9 @@ EVRInitError ivrclientcore_init(EVRInitError (*cpp_func)(void *, EVRApplicationT if (error) WARN("error %#x\n", error); + else + compositor_data.client_core_linux_side = linux_side; + return error; }