[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Crash when calling C from a finalizer
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 29 Dec 2011 14:38:26 -0200
> I think it would be very valuable to have a comment on finalizers and what
> can be done in these in the reference manual. I lost a day's work
> struggling with gdb to discover that calling any method from "C" from a
> finalizer is a bad idea (crash).
>
> [...]
>
> *29 – Managing Resources*
> Life is not always that easy. [...]. This function can then release any
> resource associated with that userdatum *but it should not call a C
> function from Lua*.
>
>
> Or maybe the rule is slightly more complex. In my case, the crash happens
> with:
>
> Lua GC ---> Foobar::finalizer (custom C++ finalizer) --> pcall --> call C
> function
There is no such restriction. You should be able to do whatever you want
from a finalizer.
-- Roberto