Game Development Community

HTTP Object Question

by Matt "Mr. Pig" Razza · in Torque Game Engine · 10/01/2006 (4:17 pm) · 3 replies

I've been using the HTTP Object for a while now and wanted to make a way so that it deletes itself when it reads the last line from the file. The problem is that when it attempts to delete itself it crashes. (The game that is). Then I added a schedule call so that it deletes itself 10 seconds after the last packet (so that it can exit the function - and so that if for some reason I needed to use the same object in those 10 seconds I could). That worked fine as well.

However, now it's crashing. It was working fine before - now it doesn't. I know the schedule idea was "bad coding" but do you have any other ideas?

if (%data $= "[EoF])
{
%this.sID = schedule(10000, 0, %this.simObject.removeObject(%this.callbackNumber)); //Mark for deletion

		return;
}

Debugger output:
First-chance exception at 0x00a4b354 in HE-Windows_DEBUG.exe: 0xC0000005: Access violation reading location 0xcecececa.
Unhandled exception at 0x00a4b354 in HE-Windows_DEBUG.exe: 0xC0000005: Access violation reading location 0xcecececa.

#1
10/01/2006 (4:44 pm)
I think we've delete HTTPRequest objects when they finish by catching the callback onDisconnect() and just doing %this.delete() in there.

eg
function myHTTPRequestObject::onDisconnect(%this)
{
   echo("http request object finished:" SPC %this);
   %this.delete();
}
#2
10/01/2006 (4:46 pm)
Yeah - just figured that out too.

lol thanks anyway
#3
10/01/2006 (4:47 pm)
Heh heh.