When enumerating the dictionary content with For-Each, the twinBASIC hacks are causing mem corruption, leading to crashes.
For example, with just this simple enumerator I can see that a Collection enumerator vtable is replaced (as expected, OK), but also the adjacent field member which is used internally to maintain a linked list of live enumerators for the collection is also getting overwritten with something:
The offending code in VBA-FastDictionary is this:
With Mem.Common(0)
#If TWINBASIC Then
.saP.pvData = ObjPtr(DictEnum) + ptrSize
#Else
.saP.pvData = ObjPtr(DictEnum) + nextItemOffset
#End If
Mem.RPtr(0) = VarPtr(Vars.Keys(i)) ' --> tB internal linked list gets overwritten here
.saP.pvData = .dPtr
End With
This causes crashes, particularly when stepping through the code, since at that point there are multiple open enumerators against the collection (since the debugger breifly enumerates it for display in the IDE), and the clobbered linked list gets manipulated/corrupted.
When enumerating the dictionary content with For-Each, the twinBASIC hacks are causing mem corruption, leading to crashes.
For example, with just this simple enumerator I can see that a Collection enumerator vtable is replaced (as expected, OK), but also the adjacent field member which is used internally to maintain a linked list of live enumerators for the collection is also getting overwritten with something:
The offending code in VBA-FastDictionary is this:
This causes crashes, particularly when stepping through the code, since at that point there are multiple open enumerators against the collection (since the debugger breifly enumerates it for display in the IDE), and the clobbered linked list gets manipulated/corrupted.