[ab] [FIX] make lispbuilder-sdl-ttf "less free"
Samium Gromoff
_deepfire at feelingofgreen.ru
Fri Feb 2 23:03:11 CST 2007
This makes the cached surface to only be ordered removed if it actually exists:
diff -urN lispbuilder-new/trunk/lispbuilder-sdl-ttf/sdl-ttf/font.lisp lispbuilder-ultranew/trunk/lispbuilder-sdl-ttf/sdl-ttf/font.lisp
--- lispbuilder-new/trunk/lispbuilder-sdl-ttf/sdl-ttf/font.lisp 2007-02-02 22:51:51.000000000 +0300
+++ lispbuilder-ultranew/trunk/lispbuilder-sdl-ttf/sdl-ttf/font.lisp 2007-02-03 04:12:44.000000000 +0300
@@ -41,6 +41,7 @@
"Free's the resources used by FONT.
Closes the SDL_Font object. Explicitely free's the FONT's cached surface."
(sdl-ttf-cffi::ttf-close-font (fp-font font))
- (sdl:free-surface (cached-surface font))
+ (when (cached-surface font)
+ (sdl:free-surface (cached-surface font)))
#-clisp(cffi:cancel-finalization font)
- )
\ No newline at end of file
+ )
This avoids freeing the surfaces just right before the CFFI finalizers
are to kick in, rushing into an empty place, angry, with heavy weapons:
diff -urN lispbuilder-new/trunk/lispbuilder-sdl-ttf/sdl-ttf/sdl-util-ttf.lisp lispbuilder-ultranew/trunk/lispbuilder-sdl-ttf/sdl-ttf/sdl-util-ttf.lisp
--- lispbuilder-new/trunk/lispbuilder-sdl-ttf/sdl-ttf/sdl-util-ttf.lisp 2007-02-02 22:51:51.000000000 +0300
+++ lispbuilder-ultranew/trunk/lispbuilder-sdl-ttf/sdl-ttf/sdl-util-ttf.lisp 2007-02-03 04:18:06.000000000 +0300
@@ -27,7 +27,6 @@
`(unwind-protect
(when (init-ttf)
, at body)
- (close-font :font *default-font*)
(quit-ttf)))
(defmacro with-open-font ((font-name size &optional font-path) &body body)
@@ -47,9 +47,8 @@
`(with-init ()
(when (typep *default-font* 'font)
(error "WITH-OPEN-FONT; *default-font* is already bound to a FONT."))
- (when (initialise-font ,font-name ,size ,font-path)
+ (when (initialise-font ,font-name ,font-path ,size)
, at body
- (close-font :font *default-font*)
(setf *default-font* nil))))
;;; Functions
regards, Samium Gromoff
More information about the application-builder
mailing list