From 5515b9d9b39c6d398bbd6e44542de75ab461214f Mon Sep 17 00:00:00 2001 From: WinterSnowfall Date: Tue, 26 Nov 2024 00:16:04 +0200 Subject: [PATCH] [d3d9] Prevent device child refcount underrun --- src/d3d9/d3d9_device_child.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/d3d9/d3d9_device_child.h b/src/d3d9/d3d9_device_child.h index 433a269ac8b..82b22ff71e5 100644 --- a/src/d3d9/d3d9_device_child.h +++ b/src/d3d9/d3d9_device_child.h @@ -25,6 +25,10 @@ namespace dxvk { } ULONG STDMETHODCALLTYPE Release() { + // ignore Release calls on objects with 0 refCount + if(unlikely(!this->m_refCount)) + return this->m_refCount; + uint32_t refCount = --this->m_refCount; if (unlikely(!refCount)) { auto* pDevice = GetDevice();