B3D -> Max Conversion

BlitzMax Forums/BlitzMax Programming/B3D -> Max Conversion

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.

well you can't call operations on something you nulled out.... but what are you nulling out exactly and why... don't null it unless it's a circular reference or could lead to a circular reference.

you code above seems to say you are nulling out the object pointer in the TLink of the list but leaving the actual TLink. when you do a eachin you get back pointers from each of the TLinks. to remove an object from a list you need to remove the TLink not null or remove the actual object.

if you just remove the TLink, then object will then be cleaned up by the GC because there are no further references to it (the TLink remove method nulls it pointer to the object there by reducing the reference counter of the object.)

here's a short version of what I do.
Type TObject
	Global list:TList = New TList
	
	Field link:TLink
	Field x:Int
	Field y:int
	
	Method New()
		link = list.AddLast(Self)
	End Method
	
	Method Remove()
		link.Remove
	End Method
	
End Type
here, if you have a reference to an object and then call the Remove method, it will be removed from the global list in the type there by allowing it to be cleaned up by the GC.