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

This commit is contained in:
cdozdil
2026-05-10 18:42:52 +02:00
committed by FakeMichau
parent bf6d1917ec
commit 07787f1605
+10
View File
@@ -422,6 +422,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;
}