diff options
| author | Benoit Germain <bnt.germain@gmail.com> | 2025-07-25 12:48:27 +0200 |
|---|---|---|
| committer | Benoit Germain <bnt.germain@gmail.com> | 2025-07-25 12:48:27 +0200 |
| commit | ccf4ac6b44a378d8f0e32b8186fdc4d3b25c3bda (patch) | |
| tree | b58e3452d09c2a01ef773d26b79f1e78da727eae /src/linda.cpp | |
| parent | d8acb18ce8bf6e89a042d166f61b2934e8722cf0 (diff) | |
| download | lanes-ccf4ac6b44a378d8f0e32b8186fdc4d3b25c3bda.tar.gz lanes-ccf4ac6b44a378d8f0e32b8186fdc4d3b25c3bda.tar.bz2 lanes-ccf4ac6b44a378d8f0e32b8186fdc4d3b25c3bda.zip | |
Fix crashes in MSVC release builds related to KeeperOperationInProgress
* scope the KeeperOperationInProgress object on linda calls
* but since it's not enough, just comment it, it is only debug stuff anyway
Diffstat (limited to 'src/linda.cpp')
| -rw-r--r-- | src/linda.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/linda.cpp b/src/linda.cpp index 75d1748..56285f7 100644 --- a/src/linda.cpp +++ b/src/linda.cpp | |||
| @@ -422,17 +422,23 @@ int Linda::ProtectedCall(lua_State* const L_, lua_CFunction const f_) | |||
| 422 | // doing LindaFactory::deleteDeepObjectInternal -> keeper_call(clear) | 422 | // doing LindaFactory::deleteDeepObjectInternal -> keeper_call(clear) |
| 423 | lua_gc(L_, LUA_GCSTOP, 0); | 423 | lua_gc(L_, LUA_GCSTOP, 0); |
| 424 | 424 | ||
| 425 | LUA_ASSERT_CODE(auto const _koip{ _linda->startKeeperOperation(L_) }); | 425 | LuaError _rc{}; |
| 426 | // if we didn't do anything wrong, the keeper stack should be clean | 426 | { |
| 427 | LUA_ASSERT(L_, lua_gettop(_K) == 0); | 427 | // there is something really strange here: in Release builds, MSVC will invoke _koip destructor on stack unwinding when we raise_lua_error() below |
| 428 | 428 | // even though the variable does not exist in the stack frame because it went out of scope -> comment until we understand why, because it causes a crash | |
| 429 | // push the function to be called and move it before the arguments | 429 | //LUA_ASSERT_CODE(auto const _koip{ _linda->startKeeperOperation(L_) }); |
| 430 | lua_pushcfunction(L_, f_); | 430 | |
| 431 | lua_insert(L_, 1); | 431 | // if we didn't do anything wrong, the keeper stack should be clean |
| 432 | // do a protected call | 432 | LUA_ASSERT(L_, lua_gettop(_K) == 0); |
| 433 | LuaError const _rc{ lua_pcall(L_, lua_gettop(L_) - 1, LUA_MULTRET, 0) }; | 433 | |
| 434 | // whatever happens, the keeper state stack must be empty when we are done | 434 | // push the function to be called and move it before the arguments |
| 435 | lua_settop(_K, 0); | 435 | lua_pushcfunction(L_, f_); |
| 436 | lua_insert(L_, 1); | ||
| 437 | // do a protected call | ||
| 438 | _rc = ToLuaError(lua_pcall(L_, lua_gettop(L_) - 1, LUA_MULTRET, 0)); | ||
| 439 | // whatever happens, the keeper state stack must be empty when we are done | ||
| 440 | lua_settop(_K, 0); | ||
| 441 | } | ||
| 436 | 442 | ||
| 437 | // restore normal GC operations | 443 | // restore normal GC operations |
| 438 | lua_gc(L_, LUA_GCRESTART, 0); | 444 | lua_gc(L_, LUA_GCRESTART, 0); |
