Crash and Reboot after quiting?

BlitzMax Forums/BlitzMax Programming/Crash and Reboot after quiting?

I'm using the latest Bmax, latest syncmods, WinXP PRO SP2, latest 100. Nividia 7950 GX2 graphics drivers, 4GB Ram - 3GB Useable.

I'm also using BLide as my IDE.

Using the code below whenever I exit the app by pressing escape, half the top corner of the screen goes black and then my PC Reboots.

I'm not a technician or an experianced coder so don't exactly know what is causing it.

SuperStrict

Include "ExampleTiming.bmx"


SetGraphicsDriver GLMax2DDriver()
'SetAudioDriver "OpenAl"

Graphics 800,600,32

SetBlend(ALPHABLEND)

Global img_Block:TImage = LoadImage("gfx/T-bgrnd.png")
Global img_DangerBlock:TImage = LoadImage("gfx/T-Danger.png",FILTEREDIMAGE|MIPMAPPEDIMAGE)

MidHandleImage(img_DangerBlock)

Global ChDrTimer:Float = MilliSecs()
Global ChangeDr:Int = 1

Type Block Abstract

	Field XLoc:Double
	Field YLoc:Double
	Field Angle:Float
	Field Rotation:Float
	Field Alpha:Float
		
End Type

Global DangerBlockList:TList = CreateList()
Type DangerBlock Extends Block
	
	Function Create()
		Local db:DangerBlock = New DangerBlock
		db.Alpha = 1.0
		db.Angle = 0.0
		db.Rotation = 0.0
		db.XLoc = 400.0
		db.YLoc = 300.0
		DangerBlockList.AddLast(db)
	End Function
	
	Method DrawBlock()
		DrawImage img_Block,Xloc,YLoc,0
		SetRotation(Angle)
		SetAlpha(Alpha)
		DrawImage img_DangerBlock,Xloc+25,YLoc+25,0
		SetAlpha(1)
		SetRotation(0)
	End Method
	
	Method AnimateBlock()
		Angle:+1.0 * Delta
		If Angle>360 Then Angle:-359 
		
		'Local ChangeDr:Int
		
		If Alpha >= 1.0
			ChangeDr = 1
		Else If Alpha <= 0.1
			ChangeDr = 0
		EndIf
		
		If ChangeDr = 1
			If MilliSecs() >ChDrTimer + 100.0
			ChDrTimer = MilliSecs()
			Alpha:-0.1'*Delta
			EndIf
		ElseIf ChangeDr = 0
			If MilliSecs() >ChDrTimer + 100.0
			ChDrTimer = MilliSecs()
			Alpha:+0.1' * Delta
			EndIf
		EndIf
	End Method
	
End Type

Global ScreenUpdate:Double

DangerBlock.Create

FixedRateLogic.Init()

While Not KeyHit(KEY_ESCAPE) Or AppTerminate()
	MainLogicLoop()
	Cls
	Draw()
'	Flip 0 'try this to see how it stays the same speed even with VSync off
	Flip 1
Wend
End


' -----------------------------------------------------------------------------
Function LogicWrapper()
	For Local db:DangerBlock = EachIn DangerBlockList
		db.AnimateBlock
	Next
End Function

' -----------------------------------------------------------------------------
Function Draw()
	For Local db:DangerBlock = EachIn DangerBlockList
		db.DrawBlock
	Next
End Function