diff options
Diffstat (limited to 'src/universe.cpp')
| -rw-r--r-- | src/universe.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/universe.cpp b/src/universe.cpp index 335f056..0f41585 100644 --- a/src/universe.cpp +++ b/src/universe.cpp | |||
| @@ -178,8 +178,8 @@ Universe* Universe::Create(lua_State* const L_) | |||
| 178 | 178 | ||
| 179 | // Linked chains handling | 179 | // Linked chains handling |
| 180 | _U->selfdestructFirst = SELFDESTRUCT_END; | 180 | _U->selfdestructFirst = SELFDESTRUCT_END; |
| 181 | _U->initializeAllocatorFunction(L_); | 181 | _U->initializeAllocatorFunction(L_); // this can raise an error |
| 182 | _U->initializeOnStateCreate(L_); | 182 | _U->initializeOnStateCreate(L_); // this can raise an error |
| 183 | _U->keepers.initialize(*_U, L_, static_cast<size_t>(_nbUserKeepers), _keepers_gc_threshold); | 183 | _U->keepers.initialize(*_U, L_, static_cast<size_t>(_nbUserKeepers), _keepers_gc_threshold); |
| 184 | STACK_CHECK(L_, 0); | 184 | STACK_CHECK(L_, 0); |
| 185 | 185 | ||
| @@ -463,7 +463,11 @@ int Universe::UniverseGC(lua_State* const L_) | |||
| 463 | // that manifests as a crash inside ntdll!longjmp() function, in optimized builds only | 463 | // that manifests as a crash inside ntdll!longjmp() function, in optimized builds only |
| 464 | lua_error(L_); | 464 | lua_error(L_); |
| 465 | } | 465 | } |
| 466 | } else { | ||
| 467 | // we didn't use the error message, let's keep a clean stack | ||
| 468 | lua_pop(L_, 1); // L_: U | ||
| 466 | } | 469 | } |
| 470 | STACK_CHECK(L_, 1); | ||
| 467 | 471 | ||
| 468 | // --------------------------------------------------------- | 472 | // --------------------------------------------------------- |
| 469 | // we don't reach that point if some lanes are still running | 473 | // we don't reach that point if some lanes are still running |
| @@ -472,7 +476,9 @@ int Universe::UniverseGC(lua_State* const L_) | |||
| 472 | // no need to mutex-protect this as all lanes in the universe are gone at that point | 476 | // no need to mutex-protect this as all lanes in the universe are gone at that point |
| 473 | Linda::DeleteTimerLinda(L_, std::exchange(_U->timerLinda, nullptr), PK); | 477 | Linda::DeleteTimerLinda(L_, std::exchange(_U->timerLinda, nullptr), PK); |
| 474 | 478 | ||
| 475 | _U->keepers.close(); | 479 | if (!_U->keepers.close()) { |
| 480 | raise_luaL_error(L_, "INTERNAL ERROR: Keepers closed more than once"); | ||
| 481 | } | ||
| 476 | 482 | ||
| 477 | // remove the protected allocator, if any | 483 | // remove the protected allocator, if any |
| 478 | _U->protectedAllocator.removeFrom(L_); | 484 | _U->protectedAllocator.removeFrom(L_); |
