diff --git a/src/mods/vr/runtimes/OpenXR.cpp b/src/mods/vr/runtimes/OpenXR.cpp index 24ec55aa..58be1fa6 100644 --- a/src/mods/vr/runtimes/OpenXR.cpp +++ b/src/mods/vr/runtimes/OpenXR.cpp @@ -561,10 +561,10 @@ void OpenXR::destroy() { xrDestroySession(this->session); } - if (this->instance != nullptr) { + /*if (this->instance != nullptr) { xrDestroyInstance(this->instance); this->instance = nullptr; - } + }*/ this->session = nullptr; this->session_ready = false; diff --git a/src/mods/vr/runtimes/OpenXR.hpp b/src/mods/vr/runtimes/OpenXR.hpp index 5b58c414..2fa3a217 100644 --- a/src/mods/vr/runtimes/OpenXR.hpp +++ b/src/mods/vr/runtimes/OpenXR.hpp @@ -181,7 +181,10 @@ struct OpenXR final : public VRRuntime { std::recursive_mutex event_mtx{}; std::recursive_mutex swapchain_mtx{}; - XrInstance instance{XR_NULL_HANDLE}; + // Making it static because for some reason destroying it doesn't actually completely destroy everything. + // So we must make sure it always exists if we ever re-initialize OpenXR. + static inline XrInstance instance{XR_NULL_HANDLE}; + XrSession session{XR_NULL_HANDLE}; XrSpace stage_space{XR_NULL_HANDLE}; XrSpace view_space{XR_NULL_HANDLE}; // for generating view matrices