added finalizer

Nikolay V. Razbegaev [2009-12-30 18:08]
added finalizer
Filename
streams.lisp
diff --git a/streams.lisp b/streams.lisp
index 6d9dd85..12d0174 100644
--- a/streams.lisp
+++ b/streams.lisp
@@ -35,10 +35,12 @@
                             :external-format external-format
                             :original-settings termios)))
       (push s *open-serial-streams*)
+      (trivial-garbage:finalize s (lambda () (foreign-free termios)))
       s)))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Close method for dual-channel-single-fd-gray-stream in iolib.streams,
-;; (which call %sys-close) is :around too.
+;; (which call %sys-close) is :around too.
+;; No need to call cancel-finalization case another close method will do it.
 (defmethod close :around ((stream dual-channel-tty-gray-stream) &key abort)
   (declare (ignorable abort))
   (when (fd-of stream)
ViewGit