Hi all,

I have a problem, i dont know if its to do with delphi or my app, but its not the first time i had the problem..

basiclly i have some code in my apps initialization:

[pascal]
procedure InitXShell;
begin
Clear world;
Load world from file;
Set Camera;
..
..
end;

procedure TxsWorld.LoadFromFile(const Filename: String);
begin
Create Stream
Check Header
Clear textures + shaders
Load world data
Free stream
end;
[/pascal]

My problem is while i run my app it goes to load the world from a file, creates the stream and checks the header then it goes to the end of the function (Free stream), then to another function (my finalization function) then runs several other functions and then goes back to my world loading function and trys to load the worlds data, but now of course the stream and everything has been freed and causes an error..

Does any one else have a similar problem? if so how can i stop this from happening?

Thanx for any help