fix(windows): Memory leak when EnumAdapters1 uses dxgi::adapter_t address as parameter (#4340)

This commit is contained in:
xd-byte 2025-10-25 23:06:52 +08:00 committed by GitHub
commit d3af56d6fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1059,8 +1059,9 @@ namespace platf {
return {};
}
dxgi::adapter_t adapter;
for (int x = 0; factory->EnumAdapters1(x, &adapter) != DXGI_ERROR_NOT_FOUND; ++x) {
dxgi::adapter_t::pointer adapter_p;
for (int x = 0; factory->EnumAdapters1(x, &adapter_p) != DXGI_ERROR_NOT_FOUND; ++x) {
dxgi::adapter_t adapter {adapter_p};
DXGI_ADAPTER_DESC1 adapter_desc;
adapter->GetDesc1(&adapter_desc);