Commit a6ec2d02 authored by Alastair Bridgewater's avatar Alastair Bridgewater
Browse files

sheet/sheet-parent-mixin: Fix SHEET-{ADOPT,DISOWN}-CHILD mechanism AGAIN.

  * This time for sure!

  * It turns out that a method specialized (SHEET T) comes before
a method specialized (T SHEET-PARENT-MIXIN), leading to the
generic "sheet does not accept parenting" message upon adoption.

  * Fix, by changing the specializer for the child sheet side of
the process to (SHEET SHEET-PARENT-MIXIN), which is more specific
than (SHEET T), and doesn't (CALL-NEXT-METHOD).

  * And this should be the last time that we need to fix this
mechanism, as it has been tested and found to work, at least for
adoption.
parent 1c75891c
......@@ -6,6 +6,7 @@
(cl:defpackage :nq-clim/sheet/sheet-parent-mixin
(:use :cl
:nq-clim/sheet/sheet
:nq-clim/sheet/sheet-hierarchy-protocol)
(:export
"SHEET-PARENT-MIXIN"))
......@@ -14,12 +15,12 @@
(defclass sheet-parent-mixin ()
((parent :initform nil :reader sheet-parent)))
(defmethod sheet-adopt-child (sheet (child sheet-parent-mixin))
(defmethod sheet-adopt-child ((sheet sheet) (child sheet-parent-mixin))
(when (sheet-parent child)
(error 'sheet-already-has-parent :sheet child))
(setf (slot-value child 'parent) sheet))
(defmethod sheet-disown-child (sheet (child sheet-parent-mixin) &key (errorp t))
(defmethod sheet-disown-child ((sheet sheet) (child sheet-parent-mixin) &key (errorp t))
(if (eq (sheet-parent child) sheet)
(setf (slot-value child 'parent) nil)
(when errorp
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment