Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid memory leak in point-sprite texture swaps #1770

Merged

Conversation

@PatrickvL
Copy link
Member

PatrickvL commented Nov 7, 2019

On Xbox, point-sprites must use texture channel 3 (three).
On Windows Direct3D, point-sprites must use texture channel 0 (zero).

To make point-sprites visible, we already copy the texture reference from channel 3 over to channel 0.
So point-sprites already work.

However, all resources retrieved from Direct3D internal state, including textures, must always be Release()'ed once the variable goes out of scope. Failing to do so, would introduce a dangling reference, leading to a memory leak.

This PR fixes an oversight on this, related to the point-sprite scenario described above.

Other than preventing this leak, there should be no other discernible effect from this change.

Small code-cleanup
@LukeUsher LukeUsher merged commit 97b13c3 into Cxbx-Reloaded:develop Nov 7, 2019
3 checks passed
3 checks passed
Cxbx-Reloaded.Cxbx-Reloaded Build #20191107.1 succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@PatrickvL PatrickvL deleted the PatrickvL:fix_memleak_pointsprite_textures branch Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.