- (make-instance class :location (reference-foreign class location))
- (error "Object at ~A has an unkown type number: ~A"
- location (%type-number-of-ginstance location)))))
-
-(defmethod copy-from-alien-form (location (class ginstance-class) &rest args)
- (declare (ignore location class args))
+ (apply #'call-next-method class location initargs)
+ (error "Object at ~A has an unkown type number: ~A"
+ location (%type-number-of-ginstance location)))))
+
+(defmethod make-proxy-instance ((class ginstance-class) location &rest initargs)
+ (declare (ignore initargs))
+ (reference-foreign class location)
+ ;; Since we make an explicit reference to the foreign object, we
+ ;; always have to release it when the proxy is garbage collected
+ ;; and therefor ignore the weak-p argument.
+ (call-next-method class location :weak nil))
+
+(defmethod invalidate-instance ((instance ginstance))
+ (declare (ignore instance))
+ ;; A ginstance should never be invalidated since it is ref counted
+ nil)
+
+(define-type-method copy-from-alien-form ((type ginstance) location)
+ (declare (ignore location type))