[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Light userdata and destroyed objects
- From: Florian Weimer <fw@...>
- Date: Mon, 08 Jun 2009 21:34:14 +0200
* Dmitry Maluka:
> Suppose that we have a Lua function foo() that creates a foo object,
> stores it in application's internal data structures and returns a light
> userdata pointer to it. The unfoo() function destroys that object and
> frees the corresponding data structures. After that, all the light
> userdata references to it are broken and may crash the application.
>
> Any approaches to this problem?
Use a full userdata object and zero the embedded pointer when unfoo()
is called.