-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
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:
For Each v In d
Next vThe 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 WithThis 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels