Skip to content

Commit

Permalink
Merge pull request #1770 from PatrickvL/fix_memleak_pointsprite_textures
Browse files Browse the repository at this point in the history
Avoid memory leak in point-sprite texture swaps
  • Loading branch information
LukeUsher committed Nov 7, 2019
2 parents d50cc9c + 9aea685 commit 97b13c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/hle/D3D8/Direct3D9/TextureStates.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 97b13c3

Please sign in to comment.