You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting a Segmentation Fault when I run the following code. I tested with a lot of different setups, but it seems once I call set_default_handler there is a fault when the program ends. I tried tracing with the debugger, but the access violation happens right as main ends and I can't find what is causing it.
I tried putting the error function in a lua script, creating it c++ and then using set_function, inlining it, lambdas....
#include <string>
#include "sol.hpp"
// the following code causes a segmentation fault.
// compiled with visual studio 2015 community debug mode.
// tested with lua51, lua5.3.3, luajit 2.0, and luajit 2.1 beta.
int main() {
sol::state lua;
lua.script(
"function the_error_handler(msg)"
" return(msg)"
"end"
);
sol::protected_function::set_default_handler(lua["the_error_handler"]);
return 0;
}
The text was updated successfully, but these errors were encountered:
Oops. This error is because the lua state gets destructed before the handler for it does and it dies and everything is sad.
Temporary fix on my end would be to set an empty default handler in the destructo of sol::state. It won't help people who use sol::state_view, but it should help most everyone else...
I'm getting a Segmentation Fault when I run the following code. I tested with a lot of different setups, but it seems once I call set_default_handler there is a fault when the program ends. I tried tracing with the debugger, but the access violation happens right as main ends and I can't find what is causing it.
I tried putting the error function in a lua script, creating it c++ and then using set_function, inlining it, lambdas....
The text was updated successfully, but these errors were encountered: