ClearWorld error?

Blitz3D Forums/Blitz3D Programming/ClearWorld error?

SLotman(Posted 2008) [#1]
I´m getting this strange problem... on debug mode, when I´m exiting my game, when I call "ClearWorld True,True,True", it gives me an error "Entity does not exist" (twice!)

Then I get a "Visual C Runtime Error - abnormal program termination", and after clicking OK on that, another error, this time a MAV.

All of that after I released all my objects and everything... and call ClearWorld just to be safe!

P.S.:This *only* happens on debug mode... I´m on 1.99 btw.

Has anyone ever happened to face this? what could be the problem???


Mortiis(Posted 2008) [#2]
If you clear the type fields but do not delete types it will produce "Entity does not exist". Try deleting all the types manually after clearworld.


SLotman(Posted 2008) [#3]
I am deleting every type.... :(

More info the error gives me:

AppName:blitzcc.exe AppVer:0.0.0 ModName:debugger.dll
ModVer: 0.0.0 Offset:0000ad52

Exception Information
Code:0xc0000005 Flags:0x0
Record:0x0 Address:0x01flad52

System Information
Windows NT 5.1 Build 2600
CPU Vendor Code: 768E6547 - 49656E69 - 6C65746E
CPU Version:6EC CPU Feature Code: AFE9FBFF
CPU AMD Feature Code: 00D5E824


Is this a problem with the debugger? Again, I get no error on non-debug mode...

Unfortunaly I didnt manage to reproduce it yet with just code... :(

Edit: If I just call "END" instead of clearworld, it gives a MAV and the debugger just crashes...!


SLotman(Posted 2008) [#4]
Just managed to find the error... this code:

Graphics3D 640,480,0,2
camera=CreateCamera()
trophy=LoadMesh("trophy.b3d")
ScaleEntity trophy,0.005,0.005,0.005
MoveEntity camera,0,0,-2

While Not KeyHit(1)
   Cls
   UpdateWorld
   RenderWorld
   Flip False
Wend

FreeEntity trophy

End


Gives the exact same problem!

The mesh render perfectly. Or the error is some untrapped thing inside B3D debugger, or B3D pipeline is doing something wrong when exporting the mesh...

Yes, definitively I bug between the two... exporting the mesh without a scene root causes the crash, with the scene root, it works perfectly!


Warner(Posted 2008) [#5]
Well, not sure, but it could have something to do with when one object is a child of another object. If you free a parent object before freeing the child, it will raise an 'entity does not exist' error.



FlagDKT(Posted 2008) [#6]
It happens on exit, for example when activating [enable extensions] on 3dsmax export without [scene root] checked.
Those problems are related to b3d files, usually with some illegal hierarchy situation.

p.s. About your example: If you free an entity, you free all his hierarchy. Therefore the second cube that is linked to the first, is cleared with the first freeEntity command. :)


Warner(Posted 2008) [#7]
Yes, so my guess is that the illegal hierarchy is causing Blitz3D to do the same thing: FreeEntity attempts to free a child entity, while it is allready freed along with it's parent.
In that case, a way around this might be: loop though all the children of the mesh, and then freeing them manually:
Function ClearEntity(mesh)

	For i = 1 To CountChildren(mesh)
		ClearEntity GetChild(mesh, i)
	Next
	
	FreeEntity mesh
	
End Function