summaryrefslogtreecommitdiff
path: root/indra/newview/llmanip.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-06-18 09:13:44 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-06-18 09:13:44 -0400
commit6bbd39f54a71a1d223c6e74b47c6b0cf9f72eb7e (patch)
treefdb3df84b454dc4bced320249528154da953ae7d /indra/newview/llmanip.cpp
parentaff78224a026bbf17e6ac4818228c0e1814c4226 (diff)
lua_emplace<T>() should permit GC despite LL.atexit() safety net.
lua_emplace<T>() was passing LL.atexit() a closure binding the new userdata with a cleanup function. The trouble with that was that a strong reference to the new userdata would prevent it ever being garbage collected, even if that was the only remaining reference. Instead, create a new weak table referencing the userdata, and bind that into the cleanup function's closure. Then if the only remaining reference to the userdata is from the weak table, the userdata can be collected. Make lua_emplace_call_gc<T>() check the bound weak table in case the userdata has in fact been collected. Also, in lua_toclass<T>(), use luaL_checkudata() to synopsize comparing the putative userdata's metatable against the one synthesized by lua_emplace<T>(). This saves several explicit steps.
Diffstat (limited to 'indra/newview/llmanip.cpp')
0 files changed, 0 insertions, 0 deletions