summaryrefslogtreecommitdiff
path: root/source/3rd-party/Luax/luax_class.inl
diff options
context:
space:
mode:
Diffstat (limited to 'source/3rd-party/Luax/luax_class.inl')
-rw-r--r--source/3rd-party/Luax/luax_class.inl9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/3rd-party/Luax/luax_class.inl b/source/3rd-party/Luax/luax_class.inl
index 95965ff..1d6a89f 100644
--- a/source/3rd-party/Luax/luax_class.inl
+++ b/source/3rd-party/Luax/luax_class.inl
@@ -95,7 +95,7 @@ namespace Luax
if (pdead == nullptr)
return;
// ϴʵʹReleaseͷš
- LuaxNativeClass* p = static_cast<LuaxNativeClass*>(pdead);
+ TYPE* p = static_cast<TYPE*>(pdead);
assert(p->mSafer);
::operator delete(pdead, size);
}
@@ -384,6 +384,7 @@ namespace Luax
int LuaxNativeClass<TYPE, BASE>::__gc(lua_State* L)
{
LUAX_STATE(L);
+
TYPE* self = state.GetUserdata<TYPE>(1);
assert(self);
@@ -391,8 +392,10 @@ namespace Luax
std::cout << "Luax: GC<" << TYPE::GetLuaxClassName() << ">\n";
#endif
- --self->mWatchDog.mVMRef;
- self->LuaxNativeClass<TYPE, BASE>::Release();
+ if(self->mWatchDog.mVMRef > 0)
+ --self->mWatchDog.mVMRef;
+
+ self->Release();
return 0;
}