chiark / gitweb /
Custom types are now re-registered when a saved image is loaded
[clg] / glib / gtype.lisp
index d05cc35e87b0320e1d38b1efff58024fdae22f0e..f4862115587f422c62d2b728d5fd8921b3f75405 100644 (file)
@@ -20,7 +20,7 @@
 ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-;; $Id: gtype.lisp,v 1.48 2006/02/26 16:12:25 espen Exp $
+;; $Id: gtype.lisp,v 1.51 2006/04/18 11:42:20 espen Exp $
 
 (in-package "GLIB")
 
@@ -143,6 +143,9 @@ (defun reinitialize-all-types ()
   (mapc #'(lambda (type) 
            (register-type (car type) (cdr type)))
        *registered-types*)
+  (mapc #'(lambda (type) 
+               (apply #'register-new-type type))
+       *registered-static-types*)
   (mapc #'(lambda (type) 
            (register-type-alias (car type) (cdr type)))
        *registered-type-aliases*))
@@ -298,7 +301,6 @@ (defun update-size (class)
 
 
 (defmethod finalize-inheritance ((class ginstance-class))
-  (call-next-method)
   (let* ((class-name (class-name class))
         (super (most-specific-proxy-superclass class))
         (gtype (or 
@@ -320,8 +322,8 @@              (default-alien-type-name class-name)))
           (not (eq (class-name super) (supertype type-number))))
       (warn "Super class mismatch between CLOS and GObject for ~A"
        class-name)))
-  
-  (update-size class))
+  (update-size class)
+  (call-next-method))
 
 
 (defmethod shared-initialize ((class ginstance-class) names &rest initargs)
@@ -386,9 +388,10 @@ (define-type-method copy-from-alien-function ((type ginstance))
   (error "Doing copy-from-alien on a ref. counted class is most certainly an error, but if it really is what you want you should use REFERENCE-FOREIGN on the returned instance instead."))
 
 (define-type-method reader-function ((type ginstance))
-  #'(lambda (location &optional (offset 0) weak-p)
-      (declare (ignore weak-p))
-      (ensure-proxy-instance type (sap-ref-sap location offset))))
+  (let ((class (type-expand type)))
+    #'(lambda (location &optional (offset 0) weak-p)
+       (declare (ignore weak-p))
+       (ensure-proxy-instance class (sap-ref-sap location offset)))))
 
 
 ;;;; Registering fundamental types