My ConstraintMorphs are parameterized using pluggable blocks. This is causing problems with dangling pointers:
ConstraintMorph instvar targetBlock points to a BlockContext BlockContext home points to a MethodContext indexed fields of MethodContext hang on to their last arguments
That is, I'm doing something like this in ConstraintMorph>>connectToNearestPoint
constraintMorph _ [ :c :m | m nearestPointTo: c center ].
And as soon as that block is evaluated with m set to another Morph, I can't get rid of the reference to m.
I'm using a WeakArray in ConstraintMorph, but it's not doing any good, since the indexed fields in the MethodContext aren't weak.
Is this a case of needing real closures?
Any suggestions? Should I stay away from pluggable blocks and use selectors instead (which is what seems to be done for the Pluggable*Morph family)?
One idea I had was, since the input to the constraint is typically a Morph, I could try to determine if the Morph had been deleted by looking at its owner. Is this likely to be reliable?
squeak-dev@lists.squeakfoundation.org