Be sure real swapchain is released to prevent swapchain re-creating issues

This commit is contained in:
cdozdil
2026-05-08 22:48:27 +03:00
parent 95a62fe90f
commit 8d5e2b5105
+10
View File
@@ -473,6 +473,16 @@ ULONG STDMETHODCALLTYPE WrappedIDXGISwapChain4::Release()
auto refCount = _real->Release();
// Release real swapchain, otherwise it can cause issues when re-creating swapchain with same handle
while (refCount > 0)
{
LOG_DEBUG("Waiting for real swapchain to be released, refCount: {}", refCount);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
refCount = _real->Release();
}
LOG_DEBUG("Real swapchain released, refCount: {}", refCount);
delete this;
}