diff --git a/src/dxgi/dxgi_swapchain.cpp b/src/dxgi/dxgi_swapchain.cpp index adfa667e..60ae6bf8 100644 --- a/src/dxgi/dxgi_swapchain.cpp +++ b/src/dxgi/dxgi_swapchain.cpp @@ -838,7 +838,7 @@ namespace dxvk { HRESULT hr = m_monitorInfo->AcquireMonitorData(hMonitor, ppData); - if (FAILED(hr)) { + if (FAILED(hr) && HasLiveReferences()) { // We may need to initialize a DXGI output to populate monitor data. // If acquiring monitor data has failed previously, do not try again. if (hMonitor == m_monitor && !m_monitorHasOutput) diff --git a/src/util/com/com_object.h b/src/util/com/com_object.h index 75188d5c..7468bc06 100644 --- a/src/util/com/com_object.h +++ b/src/util/com/com_object.h @@ -68,10 +68,14 @@ namespace dxvk { } } - ULONG GetPrivateRefCount() { + ULONG GetPrivateRefCount() const { return m_refPrivate.load(); } - + + bool HasLiveReferences() const { + return bool(m_refCount.load() | m_refPrivate.load()); + } + protected: std::atomic m_refCount = { 0ul };