Il 18/03/2013 15:35, Michael S. Tsirkin ha scritto:
> There's no harm AFAICT in doing this and it seems more
logical to me to
> have destruction flow start with the subclass and move up to the base
> class.
At Paolo's request children are intentionally reported before parents,
shouldn't this apply?
That's ok. Because children are reported first, the parent's path will
still be in place while the children are being unparented.
Subclasses and the composition tree form two different dimensions, but
in both cases the idea is to unparent bottom-up:
1) subclasses dictate the order in which to unparent a single object.
The subclasses should be "disconnected" first, before moving up towards
Object whose unparenting is done by object_parent_del_child. This way,
when a subclass's unparent runs the superclass's bits are still in a
good state.
2) the composition tree dictates the order in which to unparent multiple
objects. Here children should be unparented first. This way, when a
child's unparent runs the parent is still in a good state.
Paolo