So to insert a link in another link you have to patch both sides of the link to the two surrounding the insert position
Oh. No, I'm not inserting a link into another link. I just remove one link and then generate another by adding it into a new list. I always know the new list it's going into. I just don't want to know which one it's already in, for speed reasons.
Gab, not sure what you mean. Have you got some runnable example code?
Not yet, that's why I'm posting, because I don't know what code is affecting it. It's an apparently simple problem, but would have been spotted a long time ago if it really was as simple as it appears. Somehow the TLinks are getting corrupted or being reused, or something.
Isn't the TLINK destroyed when you remove from one list and a new one created when adding to another?
Yep, I don't keep any other references to the link, so they should all be collected the next time the GC goes into action. Although I don't force the GC to collect immediately.