From 47baf71618146b3fd5fc6ec92c326acb9a026cce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8ger=20Hanseg=C3=A5rd?= <joger.hanseg...@qt.io>
Date: Fri, 16 Jun 2023 11:08:00 +0200
Subject: [PATCH] Fix reference counting bug in Microsoft::WRL::ComPtr::Attach
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Microsoft::WRL::ComPtr::Attach should take ownership of an interface and
must therefore not increment the reference count of the attached
interface pointer.

This patch fixes this issue, and makes the MINGW64 implementation
behave the same way as the implementation shipped with the Microsoft
SDK.

Fixes: #892 Microsoft::WRL::ComPtr::Attach leaks references
Signed-off-by: Jøger Hansegård <joger.hanseg...@qt.io>
---
 mingw-w64-headers/include/wrl/client.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mingw-w64-headers/include/wrl/client.h 
b/mingw-w64-headers/include/wrl/client.h
index 12239e108..aeb886ea8 100644
--- a/mingw-w64-headers/include/wrl/client.h
+++ b/mingw-w64-headers/include/wrl/client.h
@@ -206,7 +206,6 @@ namespace Microsoft {
                 if (ptr_ != other) {
                     InternalRelease();
                     ptr_ = other;
-                    InternalAddRef();
                 }
             }
 
-- 
2.40.1.windows.1

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to