aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorVitalie Spinu2019-05-08 11:12:29 +0200
committerVitalie Spinu2019-05-08 11:12:29 +0200
commit1c6484e975e8b0e50d22980d02a3be6c9bf93b49 (patch)
tree468e78c685dacbf98d84e7c8a76762ae03c31622 /lisp
parent37436fe6d32539b03d1c4dbd535d5409bef5ac09 (diff)
downloademacs-1c6484e975e8b0e50d22980d02a3be6c9bf93b49.tar.gz
emacs-1c6484e975e8b0e50d22980d02a3be6c9bf93b49.zip
Fix incorrect cloning of eieio-instance-inheritor objects (Bug#34840)
* lisp/emacs-lisp/eieio-base.el (clone): Unbound slots of eieio-instance-inheritor objects as documented in the docs string and implemented in the original eieio implementation.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/eieio-base.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index 3aeda92db12..62f4c82026e 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -64,10 +64,18 @@ SLOT-NAME is the offending slot. FN is the function signaling the error."
64 ;; Throw the regular signal. 64 ;; Throw the regular signal.
65 (cl-call-next-method))) 65 (cl-call-next-method)))
66 66
67(cl-defmethod clone ((obj eieio-instance-inheritor) &rest _params) 67(cl-defmethod clone ((obj eieio-instance-inheritor) &rest params)
68 "Clone OBJ, initializing `:parent' to OBJ. 68 "Clone OBJ, initializing `:parent' to OBJ.
69All slots are unbound, except those initialized with PARAMS." 69All slots are unbound, except those initialized with PARAMS."
70 (let ((nobj (cl-call-next-method))) 70 ;; call next method without params as we makeunbound slots anyhow
71 (let ((nobj (if (stringp (car params))
72 (cl-call-next-method obj (pop params))
73 (cl-call-next-method obj))))
74 (dolist (descriptor (eieio-class-slots (class-of nobj)))
75 (let ((slot (eieio-slot-descriptor-name descriptor)))
76 (slot-makeunbound nobj slot)))
77 (when params
78 (shared-initialize nobj params))
71 (oset nobj parent-instance obj) 79 (oset nobj parent-instance obj)
72 nobj)) 80 nobj))
73 81