realbasic-nug
[Top] [All Lists]

Re: Dangerous deallocation/circular reference...

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Dangerous deallocation/circular reference...
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Thu, 11 Jul 2002 16:05:36 -0500
At 12:03 PM -0700 7/11/02, Brady Duga wrote:

And in fact, as you've described it, the Tickled object won't go away at all. The Tickler still has a reference to it, so until the Tickler object dies (which presumably won't be until the app exits), anything it has a reference to will stay alive too.

I assume the Tickler would go away when its ref count dropped to 0.

Yes. And that will be when the app quits, right? You must have some global reference to it; how does the Timer tell it to do its thing?

I'm not sure I explained this correctly.

I think you did.

In that call, it sets the mTickler reference to nil if IAmDone() returns true, leaving:

       0                          1
mTickler  ----> mTickeled

Doesn't this cause mTickler to vanish?

Only if you have no other references to the Tickler object, which I find hard to believe.

Cheers,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'


<Prev in Thread] Current Thread [Next in Thread>