Skip to content
Permalink
Browse files

Merge pull request #1770 from PatrickvL/fix_memleak_pointsprite_textures

Avoid memory leak in point-sprite texture swaps
  • Loading branch information...
LukeUsher committed Nov 7, 2019
2 parents d50cc9c + 9aea685 commit 97b13c35facacd8b4cec08f3777f69d86d4997c7
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/core/hle/D3D8/Direct3D9/TextureStates.cpp
@@ -260,6 +260,10 @@ void XboxTextureStateConverter::Apply()
g_pD3DDevice->GetTexture(3, &pTexture);
g_pD3DDevice->SetTexture(0, pTexture);

// Avoid a dangling reference that would lead to a memory leak
if (pTexture != nullptr)
pTexture->Release();

// disable all other stages
g_pD3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
g_pD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);

0 comments on commit 97b13c3

Please sign in to comment.
You can’t perform that action at this time.