- (let ((class (class-of instance))
- (type (type-of instance))
- (location (proxy-location instance)))
- (declare (type symbol type) (type system-area-pointer location))
- (let ((free (proxy-class-free class)))
- #'(lambda ()
- (when (instance-cached-p location)
- (remove-cached-instance location)
- (funcall free type location))))))
-
-
-(deftype-method translate-type-spec proxy (type-spec)
- (declare (ignore type-spec))
- (translate-type-spec 'pointer))
-
-(deftype-method size-of proxy (type-spec)
- (declare (ignore type-spec))
- (size-of 'pointer))
-
-(deftype-method translate-from-alien
- proxy (type-spec location &optional weak-ref)
- `(let ((location ,location))
- (unless (null-pointer-p location)
- (ensure-proxy-instance ',type-spec location ,weak-ref))))
-
-(deftype-method translate-to-alien
- proxy (type-spec instance &optional weak-ref)
- (if weak-ref
- `(proxy-location ,instance)
- (let ((copy (proxy-class-copy (find-class type-spec))))
- (if (symbolp copy)
- `(,copy ',type-spec (proxy-location ,instance))
- `(funcall ',copy ',type-spec (proxy-location ,instance))))))
-
-(deftype-method unreference-alien proxy (type-spec location)
- (let ((free (proxy-class-free (find-class type-spec))))
- (if (symbolp free)
- `(,free ',type-spec ,location)
- `(funcall ',free ',type-spec ,location))))
+ (let ((location (proxy-location instance))
+ (class (class-of instance)))
+;; (unless (find-method #'unreference-foreign nil (list (class-of class) t) nil)
+;; (error "No matching method for UNREFERENCE-INSTANCE when called with class ~A" class))
+ #'(lambda ()
+ (when (instance-cached-p location)
+ (remove-cached-instance location))
+ (unreference-foreign class location))))