[PR #821] [MERGED] Fix D3D11 resource leaks #144

Open
opened 2026-01-29 19:06:35 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/stenzek/duckstation/pull/821
Author: @CookiePLMonster
Created: 9/4/2020
Status: Merged
Merged: 9/6/2020
Merged by: @stenzek

Base: masterHead: d3d11-memleaks


📝 Commits (1)

  • 89e0290 Fix resource leaks in AutoStagingTexture::EnsureSize and D3D11HostDisplay::DownloadTexture

📊 Changes

2 files changed (+5 additions, -5 deletions)

View changed files

📝 src/common/d3d11/staging_texture.cpp (+2 -2)
📝 src/frontend-common/d3d11_host_display.cpp (+3 -3)

📄 Description

Fixes strange leaks in AutoStagingTexture::EnsureSize and D3D11HostDisplay::DownloadTexture. I say "strange" because in other places managed COM pointers were used, but those two were erroneously defined as naked pointers, as if the functions getting them did not increase their refcount.

GetDevice and GetResource both increase the refcount of the object they return, as described here:
https://docs.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicechild-getdevice
https://docs.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11view-getresource


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/stenzek/duckstation/pull/821 **Author:** [@CookiePLMonster](https://github.com/CookiePLMonster) **Created:** 9/4/2020 **Status:** ✅ Merged **Merged:** 9/6/2020 **Merged by:** [@stenzek](https://github.com/stenzek) **Base:** `master` ← **Head:** `d3d11-memleaks` --- ### 📝 Commits (1) - [`89e0290`](https://github.com/stenzek/duckstation/commit/89e0290d06af703bd42cdd207c9056456a427f37) Fix resource leaks in AutoStagingTexture::EnsureSize and D3D11HostDisplay::DownloadTexture ### 📊 Changes **2 files changed** (+5 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/common/d3d11/staging_texture.cpp` (+2 -2) 📝 `src/frontend-common/d3d11_host_display.cpp` (+3 -3) </details> ### 📄 Description Fixes strange leaks in `AutoStagingTexture::EnsureSize` and `D3D11HostDisplay::DownloadTexture`. I say "strange" because in other places managed COM pointers were used, but those two were erroneously defined as naked pointers, as if the functions getting them did not increase their refcount. `GetDevice` and `GetResource` both increase the refcount of the object they return, as described here: https://docs.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicechild-getdevice https://docs.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11view-getresource --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 19:06:35 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/duckstation#144