I suppose I could have the Tickler break the circle instead, after
the call to the Tickled, but I need to have some way of
communicating that from the Tickled, which is the object that knows
when the task is complete...
If the tickled object knows when the task is complete, it should be
responsible for disposing the Tickler. So give the Tickler a method
Dispose which stops it and sets the owning tickled object property to
nil.
Tickler.Stop:
mode = 0
Tickler.Dispose:
Stop
owner = nil
So when a tickled object calls tickler.dispose, it may not re-use the
tickler again but can safely set tickler = nil. After that, the
tickler will get garbaged. (I'm not sure how smart RB is with running
timers, so it makes sense to stop it before destroying it, even if it
checks the owner object for nil before calling any method of it.)
Regards,
Erich
|