Skip to content

Commit

Permalink
don't close lua state on cart close
Browse files Browse the repository at this point in the history
  • Loading branch information
jtothebell committed Jan 28, 2024
1 parent 6fc6058 commit f8eabd1
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions source/vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,22 @@ Vm::Vm(
Vm::~Vm(){
CloseCart();

Logger_Write("printing stack before close\n");
if (_luaState != nullptr) {
Logger_Write("printing stack before close\n");
printLuaStack(_luaState);

printLuaStack(_luaState);
printLuaStack(_luaState);

Logger_Write("closing lua state\n");
Logger_Write("closing lua state\n");

lua_close(_luaState);
_luaState = nullptr;
Logger_Write("closed lua state\n");
lua_close(_luaState);
_luaState = nullptr;
Logger_Write("closed lua state\n");
}
else {
Logger_Write("lua state was null\n");
}


if (_cleanupDeps){
if (_input != nullptr) {
Expand Down Expand Up @@ -668,11 +675,11 @@ void Vm::CloseCart() {
_loadedCart = nullptr;
}

if (_luaState) {
Logger_Write("closing lua state\n");
lua_close(_luaState);
_luaState = nullptr;
}
// if (_luaState) {
// Logger_Write("closing lua state\n");
// lua_close(_luaState);
// _luaState = nullptr;
// }

Logger_Write("writing cart data\n");
if (_cartdataKey.length() > 0) {
Expand Down

0 comments on commit f8eabd1

Please sign in to comment.