lua-users home
lua-l archive

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


* 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.