Skip to content

Commit

Permalink
fix post gc
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongfq committed Aug 11, 2023
1 parent 658e9ca commit 1338ab9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions frameworks/cclua/src/olua/olua.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ void olua_postgc(lua_State *L, T *obj);
template <class T>
void olua_postgc(lua_State *L, T *obj)
{
if (olua_getrawobj(L, obj)) {
T *self = olua_checkobj<T>(L, -1);
if (self == obj) {
int ownership = olua_getownership(L, -1);
if (ownership == OLUA_OWNERSHIP_VM) {
if (std::is_void<T>()) {
Expand All @@ -203,7 +204,8 @@ void olua_postgc(lua_State *L, T *obj)
obj->~T();
}
olua_setrawobj(L, -1, nullptr);
lua_pop(L, 1);
} else {
luaL_error(L, "object error");
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion tools/lua-bindings/olua
Submodule olua updated 1 files
+4 −2 olua.hpp

0 comments on commit 1338ab9

Please sign in to comment.