When wrapping a Morph into a flex shell, first add the flex shell to the Morph's owner (and thus to the Morph's world) before making the Morph a submorph of the flex shell.
This avoids unnecessarily sending outOfWorld: to the Morph when adding it to the new flex shell (which doesn't have a world after creation) and intoWorld: when adding the flex shell to the Morph's owner right thereafter.
=============== Diff against Morphic-pre.1489 ===============
Item was changed:
----- Method: Morph>>addFlexShell (in category 'rotate scale and flex') -----
"Wrap a rotating and scaling shell around this morph."
| oldHalo myWorld flexMorph anIndex |
oldHalo:= self halo.
myWorld := self world.
ifNil: [flexMorph := self newTransformationMorph asFlexOf: self]
ifNotNil: [:myOwner |
anIndex := myOwner submorphIndexOf: self.
+ "Avoid triggering outOfWorld: on self by first adding flexMorph to myOwner and only then making myself a submorph of flexMorph via asFlexOf:"
+ flexMorph := self newTransformationMorph.
- flexMorph := self newTransformationMorph asFlexOf: self.
myOwner addMorph: flexMorph asElementNumber: anIndex.
+ flexMorph asFlexOf: self.
myWorld ifNotNil: [myWorld startSteppingSubmorphsOf: flexMorph]].
self transferStateToRenderer: flexMorph.
oldHalo ifNotNil: [oldHalo setTarget: flexMorph].