[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A question about lua_toclose()
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 3 Sep 2020 11:42:19 -0300
> Roberto Ierusalimschy <roberto@inf.puc-rio.br> 于2020年9月2日周三 下午11:52写道:
> >
> > What do you mean by "safe"? What is exactly your concerns?
>
> I mean, if the C stack unwind before calling __close when raising an
> error, the pointer is unsafe. because it's on the C stack.
You are thinking in the wrong abstraction level. When Lua calls __close,
the table containing the pointer is given as a parameter. So, it is
in slot #1, as valid as it was before the call. Lua never collects
an object and uses it afterwards.
-- Roberto