I have the task of incorporating AngelScript into our game engine and I'm having some problems. The engine uses the concept of a GameObject, which can have a script attached to it. When I have the same script running on different GameObjects, things seem to get strange with seemingly random crashes.
I keep getting the following crash in the function asCContext::ExecuteNext():
*(asDWORD*)(l_fp - asBC_SWORDARG0(l_bc)) = **(asDWORD**)&m_regs.valueRegister; <---EXC_BAD_ACCESS( code=1, address=0xfffffff1 )
The following crash always happens when the same script is compiled for multiple GameObjects of the same type, and I examined the m_currentFunction variable in the context and it was calling a function that was defined in the script file and not a globally registered function.
**(asDWORD**)&m_regs.valueRegister = *(l_fp - asBC_SWORDARG0(l_bc));<---EXC_BAD_ACCESS( code=2, address=0xfffffff1 )
What are some general things to check for with theses particular crashes happening?