lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Payo Nel <payonel@hotmail.com> 于2020年4月25日周六 上午6:05写道:
>
> From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
>
> > One more question: can you be sure the __gc of a table is being called
> > twice? For what I saw in your code (the first version you sent), the

> In my dispose callback, when this code segfaults, the id passed matches the id of the userdata id i stored at the beginging
> p->id == 274, lua_tointeger(L, 2) == 274
> p->id == 740, lua_tointeger(L, 2) == 740

If the __gc of a table proxy is being called twice, p->id in dispose
callback should be the same value with the last call.

I think you need to save at least two id (Including history) in the
userdata to make sure no more proxy wrap it at the same time , if the
userdata could be wrapped more than once.
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org