On Dec 31, 2007 12:59 AM, Eric Williams <eric at oxalyn dot com> wrote:
Can I set up the timer with a property "myself as Timer" to make sure
> it doesn't go out of scope? Then, in the Timer's Action event, I can
> set the myself property to nil and it should just evaporate after the
> event ends (because no other object will hold a reference to it).
>
If I understand you correctly, this won't work. You can't simply reference
to an object somewhere and expect that reference to keep its foot in the
door, especially not a self-reference. As I understand RB's reference
counter, it will cleanup all objects that have no references (which you're
avoiding here), but it'll also find dead groups of objects that have no
other references. For example, consider the following set of objects and
references:
Window1->ObjA
Window1->ObjD
ObjA->ObjB
ObjA->ObjC
ObjB->ObjC
ObjD->ObjE
ObjE->ObjF
ObjF->ObjD
Assuming Window1 doesn't go out of scope, objects A through F will all be
available. If you then destroy the Window1->ObjD reference, objects D-F --
even though they reference each other -- are no longer available and will be
destroyed. This, of course, assumes you don't have any other references
somewhere.
--
-Adam
dingostick.com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|