Description
When the engine calls a Lua function from C++ (ExecuteLuaFunction -> accessing a soltable), the process crashes with an access violation because lua_pushnil is invoked with a null lua_State (L was nullptr). Exception: 0xC0000005 in Dependencies/lua/src/lapi.c (lua_pushnil). The crash originates from solbasic_reference::push calling into Lua while the stored lua_State is null or the Lua context has been destroyed.
To Reproduce
Steps to reproduce the behavior:
- Launch OvEditor.exe (use the Overload editor build, preferably in a debugger).
- Load a scene that contains an Actor with a Behaviour that has an attached Lua script/context.
- Trigger the shutdown/disable lifecycle for that Actor/Behaviour (for example, disable the component or stop play mode so OnDisable is invoked).
- Observe the crash in the debugger at Dependencies/lua/src/lapi.c inside lua_pushnil with the message "L was nullptr" when evaluating table[p_functionName].valid().
Expected behavior
Accessing table[p_functionName].valid() or calling ExecuteLuaFunction should not crash. If the Lua context/state is null or the sol::table reference is invalid, the engine should detect this and either skip calling the Lua function and log a warning, or ensure the LuaScript/lua_State lifetime is managed so references remain valid.
Screenshots
N/A
Description
When the engine calls a Lua function from C++ (ExecuteLuaFunction -> accessing a soltable), the process crashes with an access violation because lua_pushnil is invoked with a null lua_State (L was nullptr). Exception: 0xC0000005 in Dependencies/lua/src/lapi.c (lua_pushnil). The crash originates from solbasic_reference::push calling into Lua while the stored lua_State is null or the Lua context has been destroyed.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Accessing table[p_functionName].valid() or calling ExecuteLuaFunction should not crash. If the Lua context/state is null or the sol::table reference is invalid, the engine should detect this and either skip calling the Lua function and log a warning, or ensure the LuaScript/lua_State lifetime is managed so references remain valid.
Screenshots
N/A