You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
A quick workaround is proposed in PR #95: cache deleted pointers to avoid using them again. However, that workaround is rather "dirty" and, to an extend, also incomplete. (What if a pointer becomes valid again? When can we remove from or clear the cache?)
A clean solution should be seeked. Key options include:
use std::weak_ptr for the linkage pointers. However, the required switch to std::shared_ptr for all the STextureQuadNode pointers could have a significant performance penalty.
Reset link pointers when a node is about to be destroyed. This could require searching the entire tree, which is probably expensive.
Store the linking data another way
The text was updated successfully, but these errors were encountered:
A naive switch of the link pointers to std::weak_ptr, retrieved by making STextureQuadNode inherit from std::enable_shared_from_this and calling weak_from_this, does not work as expected. The effect is about the same as having the link pointer always be nullptr: the terrain texture in close proximity gradually loses resolution until it becomes extremely very low-res.
CPackedRaster
manages trees ofSTextureQuadNode
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.A quick workaround is proposed in PR #95: cache deleted pointers to avoid using them again. However, that workaround is rather "dirty" and, to an extend, also incomplete. (What if a pointer becomes valid again? When can we remove from or clear the cache?)
A clean solution should be seeked. Key options include:
std::weak_ptr
for the linkage pointers. However, the required switch tostd::shared_ptr
for all theSTextureQuadNode
pointers could have a significant performance penalty.The text was updated successfully, but these errors were encountered: