From 244d637a9dfef0a88895b4181ecdd3bb22116863 Mon Sep 17 00:00:00 2001 From: Youngbok Shin Date: Tue, 15 Mar 2022 14:29:32 +0900 Subject: [PATCH] Clean up swapchains properly with xrDestroySwapchain --- src/openxr/OpenXRApi.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/openxr/OpenXRApi.cpp b/src/openxr/OpenXRApi.cpp index 94881aa..8a6db33 100644 --- a/src/openxr/OpenXRApi.cpp +++ b/src/openxr/OpenXRApi.cpp @@ -2153,6 +2153,11 @@ bool OpenXRApi::initialiseSwapChains() { void OpenXRApi::cleanupSwapChains() { if (swapchains != NULL) { + for (uint32_t i = 0; i < view_count; i++) { + if (swapchains[i] != XR_NULL_HANDLE) { + xrDestroySwapchain(swapchains[i]); + } + } free(swapchains); swapchains = NULL; }