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.
* Cleaned up tokenizer to make subsyntax operations more clear.
* Explanatory comments.
* Made it so push_subsyntax could be safely called elsewhere.
* Unified terminology.
* Minor bug fix.
* State is an incredibly vaguely named variable. Changed convention to represent what it actually is.
* Also changed function name.
* Fixed bug.
For the option when we use the SDL_Renderer we change:
- the order of calls to SDL_DestroyTexture/Renderer.
Reported by valgrind on linux as an error to destroy the
renderer before the texture.
- the SDL_Renderer and texture are created when the surface is
initialized before the window is shown
It seems that creating the SDL_Renderer and Texture between the
moment the window was shown and the renderer present was introducing
a flashing blank window because of the time taken to create the
renderer/texture resources.
This is the way was supposed to be. All the filenames are supposed to be
stored without home encoding, i.e. with explicit paths.
Should fix issue #177 and make PR
https://github.com/franko/lite-xl/pull/174
unneeded.
It may also address issue #174 but would need further verifications.
Added in a validation function which fires before submitting a command enter; found it incredibly irritating to try to open something, hit enter, only to be told I'd selected a directory, and then have to go through the whole process again. (#175)