Problems with type fields

BlitzMax Forums/BlitzMax Programming/Problems with type fields

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.

Ok, I seem to be having a weird problem here. I'm trying to encapsulate the IrrBMAX commands into helper functions to make it a little easier. Problem is that one of the fields keep changing to null for no apparent reason.
Strict
Import gg.irrBMAX

Type T_I3D
 Field device:T_irrIrrlichtDevice
 Field driver:T_irrIVideoDriver
 Field smgr:T_irrISceneManager
 Field guienv:T_irrIGUIEnvironment


 Method Graphics3D:Int(width:Int, height:Int, BPP:Int = 16, WindowMode:Int = False, ..
                         VSync:Int = False,Driver = EDT_OPENGL,Shadow:Int = False)

  device = T_irrIrrlichtDevice.create(Driver,T_irrDimension2d_s32.create(Width,Height), ..
                                   BPP,WindowMode,Shadow,VSync)
  If device = Null Then Return False
DebugLog("Graphics3D device "+(device<>Null))
  driver = device.getVideoDriver()
DebugLog("Graphics3D driver "+(driver<>Null))
  smgr = device.getSceneManager()
DebugLog("Graphics3D smgr "+(smgr<>Null))
  guienv = device.getGUIEnvironment()
DebugLog("Graphics3D guienv "+(guienv<>Null))
  Return True
 End Method

 Method SetCaption(cap:String)
  device.setWindowCaption(cap)
 End Method

 Method BeginScene(red:Int,green:Int,blue:Int,alpha:Int = 0)
  driver.beginScene(True,True,T_irrSColor.createFromVals(0,200,200,200))
 End Method

 Method EndScene()
  driver.endScene()
 End Method

 Method RenderAll()
  smgr.drawAll()
  guienv.drawAll()
 End Method

 Method Run:Int()
  Return Device.Run()
 End Method

 Method EndGraphics3D()
  device.drop()
 End Method

End Type

Local I3D:T_I3D = New T_I3D
I3D.Graphics3D(640,480,32)
DebugLog ("Main device "+(I3D.device <> Null))
DebugLog ("main driver "+(I3D.driver <> Null))
DebugLog ("Main smgr "+(I3D.smgr <> Null))
DebugLog ("Main guienv "+(I3D.guienv <> Null))

I3D.SetCaption("Test App")

While (I3D.Run())
 I3D.BeginScene(200,200,200)
 I3D.RenderAll()
 I3D.EndScene()
Wend

I3D.EndGraphics3D()

So why does driver become null after exiting the Graphics3D method, but device, smgr, and guienv do not?
I even tried using Global fields and Functions and calling them directly, but same problem there as well.