lite-xl/src
Francesco Abbate aa0b2bb5fc Fix crash problem with rencache and font access
In some cases rencache was using a FontDesc pointer that was actually freed by
Lua giving segfaults errors.

In addition, some FontDesc object were not freed in some cases if the
rencache_end_frame was not called when performing the "restart" command.

The invalid access problem can happen because rencache keep some pointers to
FontDesc object but these are Lua userdata that Lua can dispose of. This
situation is prone to hard errors and we should avoid to keep pointers to
objects managed by Lua.

To this purpose we use luaL_ref/unref to bind the FontDesc into the Lua's
registry while rencache need them. We still keeps pointer to FontDesc object but
using luaL_ref we are assured they will not be disposed by Lua.

Since we are using luaL_ref/unref to inform the GC about when the objects are in
use we can now finalize the objects directly when Lua collects them. Previously
the GC metamethods was issuing a FREE command to rencache and the font was
actually freed only from the rencache_end_frame function.
2021-05-21 23:38:54 +02:00
..
api Fix crash problem with rencache and font access 2021-05-21 23:38:54 +02:00
bundle_open.m Add momentum scroll for macos 2021-04-21 09:52:16 +02:00
fontdesc.c Add assert if font loading fails during rendering 2021-04-27 11:56:02 +02:00
fontdesc.h Cleanup FontDesc struct and implementation 2021-04-26 15:56:18 +02:00
main.c Fix crash problem with rencache and font access 2021-05-21 23:38:54 +02:00
meson.build Make usage of SDL renderer optional 2021-04-29 14:15:24 +02:00
rencache.c Fix crash problem with rencache and font access 2021-05-21 23:38:54 +02:00
rencache.h Fix crash problem with rencache and font access 2021-05-21 23:38:54 +02:00
renderer.c Make usage of SDL renderer optional 2021-04-29 14:15:24 +02:00
renderer.h Make usage of SDL renderer optional 2021-04-29 14:15:24 +02:00
renwindow.c More accurate update rects / show window / present sequence 2021-05-06 09:00:36 +02:00
renwindow.h Make usage of SDL renderer optional 2021-04-29 14:15:24 +02:00