branch: externals/transient
commit 5bf26de995b9935dde5cce73c1a2d37337f3f53a
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    Prevent some misguided access of a prefix's value slot
    
    Initializing a prefix sets its `value' slot.  Initializing the `value'
    slots of its suffixes involves accessing the value stored in that slot.
    After that the values of the suffixes' `value' slot collectively specify
    the prefix's value.  The value of the prefix's `value' slot may or may
    not be identical at this point.  (For example a suffix's `init-value'
    slot may set pick a value different from the value in the prefix's
    `value' slot.)
    
    To prevent access to the potentially outdated value of the prefix's
    `value' slot, make it unbound after initializing the suffixes.
---
 lisp/transient.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index 5b766569c6..a4d52ad3ef 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -2462,7 +2462,8 @@ value.  Otherwise return CHILDREN as is.")
         (t
          (setq transient--suffixes nil)
          (setq transient--layout (transient--init-suffixes name))
-         (setq transient--suffixes (nreverse transient--suffixes)))))
+         (setq transient--suffixes (nreverse transient--suffixes))))
+  (slot-makeunbound transient--prefix 'value))
 
 (defun transient--init-prefix (name &optional params)
   (let ((obj (let ((proto (get name 'transient--prefix)))

Reply via email to