TGEA 1.7.1 Bugs: Atlas MatInstance unload error
by Bill Vee · in Torque Game Engine Advanced · 07/24/2008 (3:14 pm) · 31 replies
I have not seen this reported yet but it seems to have been in since 1.7.0.
When I load a mission with an atlas file then exit the mission then exit the program I consistently get an access violation in MatInstance::~MatInstance() at the line containing
In the debugger mMatInstList[i] come up as expression cannot be evaluated.
Call Stack
> CannonBattle_DEBUG.exe!MatInstance::~MatInstance() Line 87 + 0xe bytes C++
CannonBattle_DEBUG.exe!MatInstance::'scalar deleting destructor'() + 0x14 bytes C++
CannonBattle_DEBUG.exe!AtlasLightingPlugin::~AtlasLightingPlugin() Line 44 + 0x24 bytes C++
CannonBattle_DEBUG.exe!'dynamic atexit destructor for 'p_AtlasLightingPlugin''() + 0x13 bytes C++
CannonBattle_DEBUG.exe!doexit(int code=0, int quick=0, int retcaller=0) Line 553 C
CannonBattle_DEBUG.exe!exit(int code=0) Line 398 + 0xd bytes C
CannonBattle_DEBUG.exe!__tmainCRTStartup() Line 333 C
CannonBattle_DEBUG.exe!WinMainCRTStartup() Line 196 C
In debug I get the error every time but in a release build it will randomly crash the program on exit.
When I load a mission with an atlas file then exit the mission then exit the program I consistently get an access violation in MatInstance::~MatInstance() at the line containing
if( mMatInstList[i] == this )
In the debugger mMatInstList[i] come up as expression cannot be evaluated.
Call Stack
> CannonBattle_DEBUG.exe!MatInstance::~MatInstance() Line 87 + 0xe bytes C++
CannonBattle_DEBUG.exe!MatInstance::'scalar deleting destructor'() + 0x14 bytes C++
CannonBattle_DEBUG.exe!AtlasLightingPlugin::~AtlasLightingPlugin() Line 44 + 0x24 bytes C++
CannonBattle_DEBUG.exe!'dynamic atexit destructor for 'p_AtlasLightingPlugin''() + 0x13 bytes C++
CannonBattle_DEBUG.exe!doexit(int code=0, int quick=0, int retcaller=0) Line 553 C
CannonBattle_DEBUG.exe!exit(int code=0) Line 398 + 0xd bytes C
CannonBattle_DEBUG.exe!__tmainCRTStartup() Line 333 C
CannonBattle_DEBUG.exe!WinMainCRTStartup() Line 196 C
In debug I get the error every time but in a release build it will randomly crash the program on exit.
#23
08/12/2008 (8:09 am)
5 restarts after rebuild applying Brian's fix in Release, and no crashes, but still crash on debug exit every time.
#24
ntdll.dll!7c901230()
ntdll.dll!7c96c943()
ntdll.dll!7c949a2e()
ntdll.dll!7c9269a9()
ntdll.dll!7c949b34()
ntdll.dll!7c926abe()
ntdll.dll!7c96cde9()
ntdll.dll!7c95db5c()
ntdll.dll!7c96e062()
ntdll.dll!7c96e0d4()
ntdll.dll!7c94a5d0()
ntdll.dll!7c926abe()
ntdll.dll!7c94a5d0()
ntdll.dll!7c926a44()
ntdll.dll!7c926abe()
ntdll.dll!7c96e0d4()
ntdll.dll!7c94a5d0()
ntdll.dll!7c926abe()
ntdll.dll!7c9268ad()
ntdll.dll!7c915b4f()
ntdll.dll!7c96e0d4()
ntdll.dll!7c95db5c()
ntdll.dll!7c96cd11()
ntdll.dll!7c960af8()
ntdll.dll!7c960bf0()
ntdll.dll!7c960bcc()
ntdll.dll!7c915b4f()
ntdll.dll!7c94a5d0()
LWI-AST_DEBUG.exe!_unlock(int locknum=1233676) Line 347 C
ntdll.dll!7c915b4f()
LWI-AST_DEBUG.exe!_free_base(void * pBlock=0x1291af58) Line 103 C
LWI-AST_DEBUG.exe!_free_dbg_lk(void * pUserData=0x1291af78, int nBlockUse=1) Line 1218 + 0x9 C
LWI-AST_DEBUG.exe!_free_dbg(void * pUserData=0x1291af78, int nBlockUse=1) Line 1081 + 0xd C
LWI-AST_DEBUG.exe!operator delete(void * pUserData=0x1291af78) Line 54 + 0x10 C++
LWI-AST_DEBUG.exe!operator delete[](void * p=0x1291af78) Line 21 + 0x9 C++
> LWI-AST_DEBUG.exe!MaterialList::free() Line 164 + 0x1d C++
08/12/2008 (8:15 am)
Call stack...ntdll.dll!7c901230()
ntdll.dll!7c96c943()
ntdll.dll!7c949a2e()
ntdll.dll!7c9269a9()
ntdll.dll!7c949b34()
ntdll.dll!7c926abe()
ntdll.dll!7c96cde9()
ntdll.dll!7c95db5c()
ntdll.dll!7c96e062()
ntdll.dll!7c96e0d4()
ntdll.dll!7c94a5d0()
ntdll.dll!7c926abe()
ntdll.dll!7c94a5d0()
ntdll.dll!7c926a44()
ntdll.dll!7c926abe()
ntdll.dll!7c96e0d4()
ntdll.dll!7c94a5d0()
ntdll.dll!7c926abe()
ntdll.dll!7c9268ad()
ntdll.dll!7c915b4f()
ntdll.dll!7c96e0d4()
ntdll.dll!7c95db5c()
ntdll.dll!7c96cd11()
ntdll.dll!7c960af8()
ntdll.dll!7c960bf0()
ntdll.dll!7c960bcc()
ntdll.dll!7c915b4f()
ntdll.dll!7c94a5d0()
LWI-AST_DEBUG.exe!_unlock(int locknum=1233676) Line 347 C
ntdll.dll!7c915b4f()
LWI-AST_DEBUG.exe!_free_base(void * pBlock=0x1291af58) Line 103 C
LWI-AST_DEBUG.exe!_free_dbg_lk(void * pUserData=0x1291af78, int nBlockUse=1) Line 1218 + 0x9 C
LWI-AST_DEBUG.exe!_free_dbg(void * pUserData=0x1291af78, int nBlockUse=1) Line 1081 + 0xd C
LWI-AST_DEBUG.exe!operator delete(void * pUserData=0x1291af78) Line 54 + 0x10 C++
LWI-AST_DEBUG.exe!operator delete[](void * p=0x1291af78) Line 21 + 0x9 C++
> LWI-AST_DEBUG.exe!MaterialList::free() Line 164 + 0x1d C++
#25
ntdll.dll!7c901230()
ntdll.dll!7c96c943()
ntdll.dll!7c949a2e()
ntdll.dll!7c9269a9()
LWI-AST_DEBUG.exe!_free_base(void * pBlock=0x11fdb008) Line 103 C
ntdll.dll!7c926a44()
LWI-AST_DEBUG.exe!free(void * pUserData=0x02250000) Line 1036 + 0xb C
> LWI-AST_DEBUG.exe!dFree(void * in_pFree=) Line 1486 + 0x9 C++
08/12/2008 (8:26 am)
Hmm. About every other crash call stack looks like this... much shorterntdll.dll!7c901230()
ntdll.dll!7c96c943()
ntdll.dll!7c949a2e()
ntdll.dll!7c9269a9()
LWI-AST_DEBUG.exe!_free_base(void * pBlock=0x11fdb008) Line 103 C
ntdll.dll!7c926a44()
LWI-AST_DEBUG.exe!free(void * pUserData=0x02250000) Line 1036 + 0xb C
> LWI-AST_DEBUG.exe!dFree(void * in_pFree=) Line 1486 + 0x9 C++
#26
ntdll.dll!7c901230()
ntdll.dll!7c96c943()
ntdll.dll!7c949a2e()
ntdll.dll!7c9269a9()
ntdll.dll!7c9268ad()
ntdll.dll!7c915b4f()
ntdll.dll!7c926abe()
ntdll.dll!7c95db5c()
ntdll.dll!7c96e062()
ntdll.dll!7c96e0d4()
ntdll.dll!7c94a5d0()
LWI-AST_DEBUG.exe!GFXVertexBufferHandleBase::~GFXVertexBufferHandleBase() + 0x14 C++
LWI-AST_DEBUG.exe!GFXVertexBufferHandle::~GFXVertexBufferHandle() + 0x14 C++
0012d514()
ntdll.dll!7c9268ad()
ntdll.dll!7c915b4f()
ntdll.dll!7c96cd11()
ntdll.dll!7c95db5c()
ntdll.dll!7c96cd11()
ntdll.dll!7c960af8()
ntdll.dll!7c960bf0()
ntdll.dll!7c960bcc()
ntdll.dll!7c915b4f()
> LWI-AST_DEBUG.exe!destructInPlace(TSShapeInstance::MeshObjectInstance * p=0x0012d594) Line 570 C++
08/12/2008 (8:31 am)
In fact, call stack is different almost every time.ntdll.dll!7c901230()
ntdll.dll!7c96c943()
ntdll.dll!7c949a2e()
ntdll.dll!7c9269a9()
ntdll.dll!7c9268ad()
ntdll.dll!7c915b4f()
ntdll.dll!7c926abe()
ntdll.dll!7c95db5c()
ntdll.dll!7c96e062()
ntdll.dll!7c96e0d4()
ntdll.dll!7c94a5d0()
LWI-AST_DEBUG.exe!GFXVertexBufferHandleBase::~GFXVertexBufferHandleBase() + 0x14 C++
LWI-AST_DEBUG.exe!GFXVertexBufferHandle
0012d514()
ntdll.dll!7c9268ad()
ntdll.dll!7c915b4f()
ntdll.dll!7c96cd11()
ntdll.dll!7c95db5c()
ntdll.dll!7c96cd11()
ntdll.dll!7c960af8()
ntdll.dll!7c960bf0()
ntdll.dll!7c960bcc()
ntdll.dll!7c915b4f()
> LWI-AST_DEBUG.exe!destructInPlace
#27
@ JPaxson - Are you using a non-standard dts model( built with anything other than Max exporter)?
Also try to clean your solution and rebuilding it and see if that fixes it.
08/12/2008 (9:12 am)
So far unable to confirm 2003 debug build failure using the atlas demo.@ JPaxson - Are you using a non-standard dts model( built with anything other than Max exporter)?
Also try to clean your solution and rebuilding it and see if that fixes it.
#28
08/12/2008 (9:24 am)
@Bill. No, we are using 3DStudio Max 8 with dts exporter. Clean rebuild of my altered source base project still fails as above. To verify I went back and applied fix to clean Atlas Demo of clean 1.7.1 install, and I still get crash at same point EVERY time in debug. So it doesnt look like it is anything I introduced.
#29
08/12/2008 (9:28 am)
Just thinking. I only applied Brians fix, do I need to apply Rene's changes to the AtlasLightingPlugin constructor and destructor too?
#30
08/12/2008 (9:35 am)
I didn't apply the AtlasLightingPlugin fix that Rene mentioned and it worked ok for 2005 and 2008.
#31
I tried most of the standard dts models for TGEA(buggy,orc,wheels) with no error.
I have been using this fix for my code base and I have about 30 custom models and I can't repeat the error.
You said you tried it with a clean install. What models or mod did you try it with?
Trying to duplicate the error.
08/12/2008 (10:04 am)
Since this appears to be a dts failure (TSShapeInstance::MeshObjectInstance) then you need to narrow it down to the model causing the error. I tried most of the standard dts models for TGEA(buggy,orc,wheels) with no error.
I have been using this fix for my code base and I have about 30 custom models and I can't repeat the error.
You said you tried it with a clean install. What models or mod did you try it with?
Trying to duplicate the error.
Torque Owner JPaxson
HEAP[LWI-AST_DEBUG.exe]: HEAP: Free Heap block 12119288 modified at 121192b8 after it was freed
Unhandled exception at 0x7c901230 in LWI-AST_DEBUG.exe: User breakpoint.
I dont have a breakpoint set. Debugger says no source available and gives me option to open disassembler.