From dc0c1204d714d03fdd6f1fdad1079f89c7730cd7 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 21 Dec 2021 14:06:10 +0100 Subject: [PATCH] Add missing IDXGIFactory4.AddRef() to IDXGIFactory6 fallback This fixes an AccessViolationException when IDXGIFactory6 is not available --- src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs index 1c41b5e7..77e454a0 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs @@ -162,6 +162,8 @@ internal static partial class DeviceHelper @this->lpVtbl = Vtbl; @this->dxgiFactory4 = dxgiFactory4; + _ = dxgiFactory4->AddRef(); + *dxgiFactory6 = (IDXGIFactory6*)@this; }