From fa1ef8248ebbea92266fff544f241674f1450b9c Mon Sep 17 00:00:00 2001
From: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Date: Sat, 9 Dec 2017 22:20:40 +0100
Subject: [PATCH] [com] Fixed crashes caused by reentrant Release()

---
 src/util/com/com_object.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/util/com/com_object.h b/src/util/com/com_object.h
index 15561edba..f3e961bae 100644
--- a/src/util/com/com_object.h
+++ b/src/util/com/com_object.h
@@ -12,7 +12,7 @@
       return S_OK;                              \
     }                                           \
   } while (0)
-
+#include <iostream>
 namespace dxvk {
   
   template<typename... Base>
@@ -28,8 +28,10 @@ namespace dxvk {
     
     ULONG Release() {
       ULONG refCount = --m_refCount;
-      if (refCount == 0)
+      if (refCount == 0) {
+        refCount += 0x80000000u;
         delete this;
+      }
       return refCount;
     }