Hi all,
It is threading related, as I fixed it by setting a flag to true in the gui click event, and waiting in a loop for the flag to be set to false. In the surface draw thread, which fires 30 to 60 times a second, it checks to see if the flag is set to true, if it is it does the building up of the vanished2 variable, and sets the flag to false. The gui event then exits the loop and uses this variable. The problem went away. My guess is when the surface draw event goes through the boardcelllist, and does a get and put on each item, the gui thread just has the misfortune of accessing the data between the get and the put, and I think the item is temporarily unavailable for that brief moment.
It's now manifesting itself in a different spot as I loop through the list, but it's at random positions in the list each time. I know for a fact the list has 225 items in there, all initialized, but sometimes it fails at item 38, sometimes at 208.
I really need a Sync Lock equivalent to allow access to the list by one thread at time. Is there an equivalent technique I can use?
Richard