Game Development Community

T3D 2.0 MIT - Crash If Unmount Image From Image FSM

by Steve Acaster · in Torque 3D Professional · 02/03/2013 (12:57 pm) · 0 replies

Torque 3D 2.0 MIT (consoleRefraction branch - but not related to it specifically)

issue:
I have a disposable, single shot rocket launcher. After firing, instead of reloading it calls a script to unmount the shapeImage which causes a crash in shapeImage.cpp at UpdateImageState().

output:
First-chance exception at 0x10932765 (RDB_demo_DEBUG.dll) in RDB_demo_DEBUG.exe: 0xC0000005: Access violation reading location 0x00001570.
Unhandled exception at 0x10932765 (RDB_demo_DEBUG.dll) in RDB_demo_DEBUG.exe: 0xC0000005: Access violation reading location 0x00001570.
The program '[2648] RDB_demo_DEBUG.exe: Native' has exited with code -1073741819 (0xc0000005).

in shapeImage.cpp stack is called at
 line 3059:     if (!image.dataBlock->shapeIsValid[i] || i != imageShapeIndex && !image.doAnimateAllShapes)
 
 
 
 >	RDB_demo_DEBUG.dll!ShapeBase::updateImageState(unsigned int imageSlot=0, float dt=0.0079998448)  Line 3059 + 0x8 bytes	C++
 	RDB_demo_DEBUG.dll!ShapeBase::processTick(const Move * move=0x0012c284)  Line 1300	C++
 	RDB_demo_DEBUG.dll!Player::processTick(const Move * move=0x0012c284)  Line 2062	C++
 	RDB_demo_DEBUG.dll!StdServerProcessList::onTickObject(ProcessObject * pobj=0x0ba24044)  Line 374	C++
 	RDB_demo_DEBUG.dll!ProcessList::advanceObjects()  Line 269	C++
 	RDB_demo_DEBUG.dll!ServerProcessList::advanceObjects()  Line 179	C++
 	RDB_demo_DEBUG.dll!StdServerProcessList::advanceObjects()  Line 385	C++
 	RDB_demo_DEBUG.dll!ProcessList::onAdvanceObjects()  Line 173 + 0x19 bytes	C++
 	RDB_demo_DEBUG.dll!ProcessList::advanceTime(unsigned int timeDelta=56)  Line 237 + 0xd bytes	C++
 	RDB_demo_DEBUG.dll!serverProcess(unsigned int timeDelta=56)  Line 252 + 0x19 bytes	C++
 	RDB_demo_DEBUG.dll!processTimeEvent(int elapsedTime=56)  Line 166 + 0x9 bytes	C++
 	RDB_demo_DEBUG.dll!fastdelegate::FastDelegate1<int,void>::InvokeStaticFunction(int p1=56)  Line 1018 + 0xe bytes	C++
 	RDB_demo_DEBUG.dll!fastdelegate::FastDelegate1<int,void>::operator()(int p1=56)  Line 990 + 0x1a bytes	C++
 	RDB_demo_DEBUG.dll!Signal<void __cdecl(int)>::trigger(int a=56)  Line 498	C++
 	RDB_demo_DEBUG.dll!Journal::Call<Signal<void __cdecl(int)>,int>(Signal<void __cdecl(int)> * obj=0x02ae62b0, void (int)* method=0x10819a47, int a=56)  Line 559 + 0xa8 bytes	C++
 	RDB_demo_DEBUG.dll!JournaledSignal<void __cdecl(int)>::trigger(int a=56)  Line 81 + 0x12 bytes	C++
 	RDB_demo_DEBUG.dll!TimeManager::_updateTime()  Line 47	C++
 	RDB_demo_DEBUG.dll!fastdelegate::FastDelegate0<void>::operator()()  Line 905 + 0x16 bytes	C++
 	RDB_demo_DEBUG.dll!Signal<void __cdecl(void)>::trigger()  Line 480	C++
 	RDB_demo_DEBUG.dll!Process::processEvents()  Line 95	C++
 	RDB_demo_DEBUG.dll!StandardMainLoop::doMainLoop()  Line 603 + 0x5 bytes	C++
 	RDB_demo_DEBUG.dll!torque_enginetick()  Line 120 + 0x5 bytes	C++
 	RDB_demo_DEBUG.dll!TorqueMain(int argc=2, const char * * argv=0x013bfec8)  Line 387 + 0x5 bytes	C++
 	RDB_demo_DEBUG.dll!torque_winmain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * __formal=0x00000000, char * lpszCmdLine=0x001f3766, HINSTANCE__ * __formal=0x00000000)  Line 462 + 0x17 bytes	C++
 	RDB_demo_DEBUG.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpszCmdLine=0x001f3766, int nCommandShow=1)  Line 64 + 0x16 bytes	C++
 	RDB_demo_DEBUG.exe!__tmainCRTStartup()  Line 263 + 0x2c bytes	C
 	RDB_demo_DEBUG.exe!WinMainCRTStartup()  Line 182	C
 	kernel32.dll!7683ed6c() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	ntdll.dll!7728377b() 	
 	ntdll.dll!7728374e()

Suggested fix:
Having a delay in the script function for unmounting the shapeImage prevents the crash - but obviously the whole code function ending nicely instead of crash to desktop would be nicer.