[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Crash when calling C from a finalizer
- From: Gaspard Bucher <gaspard@...>
- Date: Thu, 29 Dec 2011 16:50:51 +0100
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).
Something like this would have helped:
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