Hello,
I have trouble terminating some processes I make. More specifically, I'm trying to terminate some processes when the their associated "owner" object is garbage collected. The problem seems that these processes hold back pointers to my owner object via outerContext of the closures so the owner object does not get garbage collected when nobody else is pointing to it.
Attached is my test case. After filing in this to a trunk image, evaluate:
k := KEventStream new. KEventStream beTimer: k with: 100.
in a workspace. You'll see a little counter going on the left edge of screen. What I want to do is to stop the counter by evaluating:
k := nil. Smalltalk garbageCollect.
but the processes hold onto the closure, which in turn holds onto the context for executing #beTimer:with:, and that context holds onto 'k', or 'anObject'.
I thought that closure could just be detached from the outer context but it is not the case here. Why?
Thank you!
-- Yoshiki