From 36cc7f2863a0e4b65782bb31e4594fe401559f1c Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sun, 9 Apr 2017 19:37:45 -0400 Subject: [PATCH] crush the stack on final error when throwing to prevent 'leaks' in bad cases --- single/sol/sol.hpp | 7 ++++--- sol/state.hpp | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index 153452a2..d114e8b1 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2017-04-09 17:03:27.912893 UTC -// This header was generated with sol 2.17.0 (revision 2df532f) +// Generated 2017-04-09 23:37:25.660210 UTC +// This header was generated with sol v2.17.0 (revision a6e03ac) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -13431,9 +13431,10 @@ namespace sol { const char* message = lua_tostring(L, -1); if (message) { std::string err = message; - lua_pop(L, 1); + lua_settop(L, 0); throw error(err); } + lua_settop(L, 0); throw error(std::string("An unexpected error occurred and forced the lua state to call atpanic")); #endif } diff --git a/sol/state.hpp b/sol/state.hpp index 4522b49b..d579d64b 100644 --- a/sol/state.hpp +++ b/sol/state.hpp @@ -33,9 +33,10 @@ namespace sol { const char* message = lua_tostring(L, -1); if (message) { std::string err = message; - lua_pop(L, 1); + lua_settop(L, 0); throw error(err); } + lua_settop(L, 0); throw error(std::string("An unexpected error occurred and forced the lua state to call atpanic")); #endif }