Problem with removing items from TList

BlitzMax Forums/BlitzMax Programming/Problem with removing items from TList

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Code is written in Strict mode. Object in list are of custom type.

Here is the code once again:

	Method RemoveObjects(all=False)
		If(all)
			ClearList(objectsList)
			Return
		Else
			If(deleteTimer._ticks<4) Return
			For temp=EachIn objectsList
				If(temp.CollideWithCursor())
					ListRemove(objectsList,temp)
					deleteTimer._ticks=0
					soundEngine.PlaySfx("usowanie")
					Return
				EndIf 
			Next
		EndIf
	End Method

	Method CollideWithCursor()				
		If(MouseX()>x And MouseX()<x+ImageWidth(brush.bitmap))
		If(MouseY()>y And MouseY()<y+ImageHeight(brush.bitmap))
			ResetCollisions()
			CollideImage(brush.bitmap,x,y,0,0,1)
			If(CollideRect(MouseX(),MouseY(),1,1,1,0)) Return True 
		EndIf
		EndIf
		Return False
	End Method