Skip to content

Commit

Permalink
[Fluid] Stop problematic crash behaviour when LuaJIT catches a C++ ex…
Browse files Browse the repository at this point in the history
…ception
  • Loading branch information
paul-manias committed Dec 19, 2024
1 parent 9472850 commit ed614df
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/fluid/fluid_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,12 @@ static ERR run_script(objScript *Self)
return ERR::Okay;
}
else {
// LuaJIT catches C++ exceptions, but we would prefer that crashes occur normally so that they can be traced in
// the debugger. As we don't have a solution to this design issue yet, the following context check will suffice
// to prevent unwanted behaviour.

if (CurrentContext() != Self) abort(); // A C++ exception was caught by Lua - the software stack is unstable so we must abort.

process_error(Self, Self->Procedure ? Self->Procedure : "run_script");
return Self->Error;
}
Expand Down

0 comments on commit ed614df

Please sign in to comment.