I take it back... I found the block. it still resides in render.c under the rndMainViewRenderFunction() i just commented it out.
it looks like this.
Code:
/*
#if defined (_MACOSX_86)
if ((long)effect->collMyBlob == 1013904225){//0x3c6ef361
dbgMessagef("rndMainViewRenderFunction: sent invalid handle: 0x%lx",(long)effect->collMyBlob);
return;
}
else if ((long)effect->collMyBlob == 1701209669){//0x65666645 )
dbgMessagef("rndMainViewRenderFunction: sent invalid handle: 0x%lx",(long)effect->collMyBlob);
return;
}
//else if (handle >= 6000){
// dbgMessagef("Valid handle: 0x%lx",handle);
//}
#endif
*/
etgEffectDraw(effect);
the addresses I was checking ultimately ended up in trMakeCurrent() as invalid handles, and i was trying to figure out how far back the problem originates... I believe my problem was actually in etgEffectDraw someplace (I havent found it yet)...
the function trace looks like this.
rndMainViewRenderFunction() //render.c
etgEffectDraw() //ETG.c
partRenderSystem() //Particle.c
partRenderMeshSystem() //Particle.c
partMeshMaterialPrepare() //Particle.c
trMakeCurrent() //texreg.c
returning at rndMainViewRenderFunction instead of trMakeCurrent caused an ion cannon bug similar to the one you are describing above. so I would imagine one of these functions is to blame.
edit: also my logic was flawed when i wrote this block. effect->collMyBlob does not become the handle down the line, it just has the same address at this point.