4 ms·
He mentions that it's fine to call Unlink twice. Presumably the first Unlink zeroes out the prev/next fields.
by kevingadd 14y ago
He mentions that it's fine to call Unlink twice. Presumably the first Unlink zeroes out the prev/next fields.
- xtdx 14y agoIndeed, I may have read the code wrong. But look at line 188. m_prevLink->m_nextNode = m_nextNode; I don't see where m_prevLink is changed. If the previous link has gone away, and you call RemoveFromList on this node a second time, it's going to chase that pointer.
- Ogre 14y agoRemoveFromList is a private method. All the public methods, other than the destructor, that call it also modify m_prevLink.
- gsg 14y agoThere's a better trick: point the link structure at itself. This avoids any need to test for null.