Closed pkulev closed 4 years ago
I've added weakref set for opened fonts to prevent any errors on closing library having refs to fonts in client code. Here's example: 1) We're creating ref to cl-sdl2-ttf font object - https://github.com/pkulev/o2/blob/7a9927d49e5d1ea74c891c6b37feb9d0c0ea8a3c/src/application.lisp#L95 2) We're closing fonts on quit before quitting SDL libraries - https://github.com/pkulev/o2/blob/7a9927d49e5d1ea74c891c6b37feb9d0c0ea8a3c/src/application.lisp#L125 3) Font already closed in cl-sdl2-ttf library, but our code still has ref to it or something. 4) Here we're quitting cl-sdl2-ttf library - https://github.com/pkulev/o2/blob/7a9927d49e5d1ea74c891c6b37feb9d0c0ea8a3c/src/application.lisp#L151 5) After that steps finalizers come to play and everything blows up.
Now with weakrefs library itself can close fonts if they are not closed, or just skip them if they are already closed from client code.
Also I've added fix for proper repo language determination, now it will be determined as CL, not python :smiley:
Hello Puklev. Sorry for seeing this so late! Thanks for the contribution!
I've added weakref set for opened fonts to prevent any errors on closing library having refs to fonts in client code. Here's example: 1) We're creating ref to cl-sdl2-ttf font object - https://github.com/pkulev/o2/blob/7a9927d49e5d1ea74c891c6b37feb9d0c0ea8a3c/src/application.lisp#L95 2) We're closing fonts on quit before quitting SDL libraries - https://github.com/pkulev/o2/blob/7a9927d49e5d1ea74c891c6b37feb9d0c0ea8a3c/src/application.lisp#L125 3) Font already closed in cl-sdl2-ttf library, but our code still has ref to it or something. 4) Here we're quitting cl-sdl2-ttf library - https://github.com/pkulev/o2/blob/7a9927d49e5d1ea74c891c6b37feb9d0c0ea8a3c/src/application.lisp#L151 5) After that steps finalizers come to play and everything blows up.
Now with weakrefs library itself can close fonts if they are not closed, or just skip them if they are already closed from client code.
Also I've added fix for proper repo language determination, now it will be determined as CL, not python :smiley: