Crash calling non-existing function of non-existing object
by Christian Rousselle · in Torque Game Builder · 04/23/2007 (11:20 am) · 5 replies
I am currently in the process of porting my game from 1.1.3 to 1.5. I came across a problem that occurs when an Element is not defined. I am not sure if this is a problem also in 1.1.3. The following line produces the error message: File.cs Unable to find object : 'SpriteScore' attempting to call function 'setFrame';
But after executing this a couple of times the game crashes. Unfortunately I cannot debug since I do not have the code. It is also not necessary to call an existing function. Y.X() will also work/crash.
SpriteScore.setFrame(0);
But after executing this a couple of times the game crashes. Unfortunately I cannot debug since I do not have the code. It is also not necessary to call an existing function. Y.X() will also work/crash.
#2
04/24/2007 (5:17 am)
Yes that is obvious - but as I mentioned it happend while porting the code and forgetting to insert some elements. Nevertheless I do not think that this is intended behaviour and may hint to a problem.
#3
04/24/2007 (7:33 am)
I'm with christian - it's disturbing because it definitely shouldn't be happening and could be an indicator of a deeper problem.
#4
Sorry this got mixed up, it turned out to be a mis-matched push/popFrame pair when it couldn't find an object to call a method on. If you've got a Pro license, here's a quick fix you can apply to your game.
console/compiledEval.cc (1357) addition in bold
This fixes the case where you do Y.X() a bunch of times and result in a crash.
Cheers,
-Justin
04/24/2007 (12:34 pm)
Hey Guys,Sorry this got mixed up, it turned out to be a mis-matched push/popFrame pair when it couldn't find an object to call a method on. If you've got a Pro license, here's a quick fix you can apply to your game.
console/compiledEval.cc (1357) addition in bold
if(!gEvalState.thisObject)
{
gEvalState.thisObject = 0;
Con::warnf(ConsoleLogEntry::General,"%s: Unable to find object: '%s' attempting to call function '%s'", getFileLine(ip-4), callArgv[1], fnName);
[b] STR.popFrame();[/b]
break;
}This fixes the case where you do Y.X() a bunch of times and result in a crash.
Cheers,
-Justin
#5
04/24/2007 (12:57 pm)
See what happens when you code without caffeine!
Torque Owner Sebastian Potter