From 22e43aff2d585cc069cae2dd914a1d6cafea2854 Mon Sep 17 00:00:00 2001
From: Liam Healy <liam@thinkpad.local>
Date: Tue, 13 Jul 2010 21:12:53 -0400
Subject: [PATCH] No finalizers in faify-form (array callbacks); add
 dependencies

---
 gsll.asd              | 14 +++++++-------
 init/funcallable.lisp |  7 ++++---
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/gsll.asd b/gsll.asd
index 6705280b..47c451e0 100644
--- a/gsll.asd
+++ b/gsll.asd
@@ -1,6 +1,6 @@
 ;; Definition of GSLL system 
 ;; Liam Healy
-;; Time-stamp: <2010-07-07 09:55:58EDT gsll.asd>
+;; Time-stamp: <2010-07-13 21:07:57EDT gsll.asd>
 ;;
 ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
 ;; Distributed under the terms of the GNU General Public License
@@ -36,8 +36,8 @@
 	    :components
 	    ((:file "init")
 	     (cffi-grovel:grovel-file "libgsl" :pathname #+unix "libgsl-unix")
-	     (:file "utility")
-	     (:file "forms")
+	     (:file "utility" :depends-on ("init"))
+	     (:file "forms" :depends-on ("init"))
 	     (:file "conditions" :depends-on ("init" "libgsl"))
 	     (:file "callback-compile-defs" :depends-on ("init"))
 	     (:file "mobject" :depends-on ("init" "callback-compile-defs"))
@@ -49,15 +49,15 @@
 	     (:file "types" :depends-on ("init" "libgsl"))
 	     (cffi-grovel:grovel-file "callback-struct"
 				      :depends-on ("types" "libgsl"))
-	     (:file "funcallable" :depends-on ("utility"))
+	     (:file "funcallable" :depends-on ("init" "utility"))
 	     (:file "interface"
 		    :depends-on ("init" "conditions"))
 	     (:file "defmfun" :depends-on ("init" "forms" "interface"))
 	     (:file "defmfun-array"
-		    :depends-on ("defmfun" "callback-included"))
+		    :depends-on ("init" "defmfun" "callback-included"))
 	     (:file "defmfun-single"
-		    :depends-on ("defmfun" "mobject" "callback"))
-	     (:file "body-expand" :depends-on ("defmfun" "mobject" "callback"))
+		    :depends-on ("init" "defmfun" "mobject" "callback"))
+	     (:file "body-expand" :depends-on ("init" "defmfun" "mobject" "callback"))
 	     (:file "generate-examples" :depends-on ("init"))))
    (:module floating-point
 	    :depends-on (init)
diff --git a/init/funcallable.lisp b/init/funcallable.lisp
index 7a518d1e..308c4870 100644
--- a/init/funcallable.lisp
+++ b/init/funcallable.lisp
@@ -1,6 +1,6 @@
 ;; Generate a lambda that calls the user function; will be called by callback.
 ;; Liam Healy 
-;; Time-stamp: <2010-07-13 12:06:01EDT funcallable.lisp>
+;; Time-stamp: <2010-07-13 21:05:37EDT funcallable.lisp>
 ;;
 ;; Copyright 2009, 2010 Liam M. Healy
 ;; Distributed under the terms of the GNU General Public License
@@ -63,19 +63,20 @@
 
 (defun faify-form (ptr argspec)
   "Make the form that turns the mpointer into a foreign-array."
+  ;; No finalizer, because pointer might be reused by GSL.
   (ecase (parse-callback-argspec argspec 'array-type)
     (:foreign-array			; a GSL mpointer
      `(make-foreign-array-from-mpointer
        ,ptr
        ',(grid:cffi-cl (parse-callback-argspec argspec 'element-type))
        ,(length (parse-callback-argspec argspec 'dimensions))
-       t))
+       nil))				; no finalizer
     (:cvector				; a raw C vector
      `(grid:make-foreign-array-from-pointer
        ,ptr
        ',(parse-callback-argspec argspec 'dimensions)
        ',(grid:cffi-cl (parse-callback-argspec argspec 'element-type))
-       t))))
+       nil))))
 
 ;;;;****************************************************************************
 ;;;; Reference foreign elements and make multiple-value-bind form
-- 
GitLab