B3D -> Max Conversion

BlitzMax Forums/BlitzMax Programming/B3D -> Max Conversion

I set the objects to Null in a For EachIn loop and was still running into issues where a crash occurred due to Null object references in my list. The only way I could avoid this was by setting the handle of my TMesh to 0 and then making sure I applied no operations on a mesh referenced from the list if the mesh didn't exist.

So I should be able to do this:

For pointer:bbType = EachIn List
   If ( Not timeExpired ) 
      Move
      Rotate
      Scale
   else
      FreeEntity( pointer.entity )
      pointer:List = Null
   endif
Next


But instead I have to resort to this:

For pointer:bbType = EachIn List
   If ( pointer.entity And ( Not timeExpired ) )
      Move
      Rotate
      Scale
   Else
      if ( pointer.entity )
         FreeEntity( pointer.entity )
         pointer.entity = 0
         pointer:List = Null
      Endif
   Endif
Next


I'll have to recheck the code, if what everyone says is true then I was using it correctly and perhaps there's another issue going on. It seems like the GC doesn't work deterministically.