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

TexturePackSurface: avoid use after delete #95

Conversation

meekee7
Copy link
Contributor

@meekee7 meekee7 commented May 8, 2020

CPackedRaster manages trees of STextureQuadNode objects. Those nodes are "linked" to each other via pointers. When a node is deleted, those link pointers are left dangling. When such a dangling pointer is dereferenced, this raises complaints when additional memory access validation (full page heap verification) is enabled.
As a quick workaround, the pointers of the deleted nodes are cached. The cache is checked to avoid dereferencing those dangling pointers.
A better solution, using either std::weak_ptr or automatic unlinking of nodes upon destruction, requires more research.

@GamerDude27 GamerDude27 merged commit 081c826 into OpenTrespasser:master May 13, 2020
@meekee7 meekee7 deleted the texturepacksurface-dangling-link-pointer2 branch May 15, 2020 18:41
GamerDude27 added a commit that referenced this pull request May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants