diff options
-rw-r--r-- | src/deep.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/deep.cpp b/src/deep.cpp index e62ca6d..f59e051 100644 --- a/src/deep.cpp +++ b/src/deep.cpp | |||
@@ -166,9 +166,9 @@ static int deep_userdata_gc( lua_State* L) | |||
166 | 166 | ||
167 | // can work without a universe if creating a deep userdata from some external C module when Lanes isn't loaded | 167 | // can work without a universe if creating a deep userdata from some external C module when Lanes isn't loaded |
168 | // in that case, we are not multithreaded and locking isn't necessary anyway | 168 | // in that case, we are not multithreaded and locking isn't necessary anyway |
169 | int v{ p->m_refcount.fetch_sub(1, std::memory_order_relaxed) }; | 169 | bool const isLastRef{ p->m_refcount.fetch_sub(1, std::memory_order_relaxed) == 1 }; |
170 | 170 | ||
171 | if( v == 0) | 171 | if (isLastRef) |
172 | { | 172 | { |
173 | // retrieve wrapped __gc | 173 | // retrieve wrapped __gc |
174 | lua_pushvalue( L, lua_upvalueindex( 1)); // self __gc? | 174 | lua_pushvalue( L, lua_upvalueindex( 1)); // self __gc? |
@@ -425,7 +425,6 @@ DeepPrelude* luaG_todeep(lua_State* L, luaG_IdFunction idfunc, int index) | |||
425 | STACK_CHECK(L, 0); | 425 | STACK_CHECK(L, 0); |
426 | 426 | ||
427 | DeepPrelude** const proxy{ lua_tofulluserdata<DeepPrelude*>(L, index) }; | 427 | DeepPrelude** const proxy{ lua_tofulluserdata<DeepPrelude*>(L, index) }; |
428 | |||
429 | return *proxy; | 428 | return *proxy; |
430 | } | 429 | } |
431 | 430 | ||