PCVR, OpenXR: xrDestroySwapchain crashes badly
My PCVR app crashes after invoking xrDestroySwapchain in the latest version of the Meta OpenXR runtime.
It doesn't matter what kind of swapchain, just calling the method on what should be a perfectly valid swapchain obtained from OpenXR gets me the following error (shown here at the end of the Output window as shown in Visual Studio 2026):
14/09 15:46:34.404 [ 33244] {WARNING} [OXR] OXRSessionData::WaitFrame adjusting predictedDisplayTime from 13418299239736 to 13418299239737
14/09 15:46:35.594 [ 33244] {WARNING} [OXR] OXRSessionData::WaitFrame adjusting predictedDisplayTime from 13419493561235 to 13419493561625 The thread 23320 has exited with code 0 (0x0).
14/09 15:46:54.944 [ 33244] {WARNING} [OXR] OXRSessionData::WaitFrame adjusting predictedDisplayTime from 13438839708235 to 13438839709227
14/09 15:47:04.889 [ 33244] {WARNING} [OXR] OXRSessionData::WaitFrame adjusting predictedDisplayTime from 13448783699636 to 13448783701328
14/09 15:47:38.444 [ 33244] {INFO} [OpenXR_OATS] Session Telemetry (0x2 [IP Changed] 10 /user/hand/left/interaction_profiles/oculus/touch_controller
14/09 15:47:38.444 [ 33244] {INFO} [OpenXR_OATS] IP changed: /user/hand/left/interaction_profiles/oculus/touch_controller,
10 14/09 15:47:38.485 [ 33244] {INFO} [OpenXR_OATS] Session Telemetry (0x2 [IP Changed] 6 /user/hand/left/interaction_profiles/oculus/touch_controller
14/09 15:47:38.486 [ 33244] {INFO} [OpenXR_OATS] IP changed: /user/hand/left/interaction_profiles/oculus/touch_controller, 6
14/09 15:47:38.678 [ 33244] {WARNING} [OXR] OXRSessionData::WaitFrame adjusting predictedDisplayTime from 13482573494137 to 13482573494226 The thread 33736 has exited with code 0 (0x0). The thread 33556 has exited with code 0 (0x0).
14/09 15:47:39.956 [ 33244] {DEBUG} [OXR] SetSessionState from XR_SESSION_STATE_FOCUSED to XR_SESSION_STATE_VISIBLE 14/09 15:47:39.956 [ 33244] {DEBUG} [OXR] SetSessionState from XR_SESSION_STATE_VISIBLE to XR_SESSION_STATE_SYNCHRONIZED 14/09
15:47:39.956 [ 33244] {DEBUG} [OXR] SetSessionState from XR_SESSION_STATE_SYNCHRONIZED to XR_SESSION_STATE_STOPPING
14/09 15:47:39.958 [ 33244] {DEBUG} [OXR] SetSessionState from XR_SESSION_STATE_STOPPING to XR_SESSION_STATE_IDLE
14/09 15:47:39.958 [ 33244] {DEBUG} [OXR] SetSessionState from XR_SESSION_STATE_IDLE to XR_SESSION_STATE_EXITING
Exception thrown at 0x0000000000000000 in *********_****.exe: 0xC0000005: Access violation executing location 0x0000000000000000.
The code at which the crash is detected is in xr_generated loader.cpp in the OpenXR loader stub, and looks like this:
extern "C" LOADER_EXPORT XRAPI_ATTR XrResult XRAPI_CALL xrDestroySwapchain( XrSwapchain swapchain) XRLOADER_ABI_TRY {
LoaderInstance* loader_instance;
XrResult result = ActiveLoaderInstance::Get(&loader_instance, "xrDestroySwapchain");
if (XR_SUCCEEDED(result)) {
result = loader_instance->DispatchTable()->DestroySwapchain(swapchain); // <-- crash here
}
return result;
}
XRLOADER_ABI_CATCH_FALLBACK
Anyone else have seen this? Any fix you can provide?
