Re: Distributed Objects, delegates, and retain cycles
Re: Distributed Objects, delegates, and retain cycles
- Subject: Re: Distributed Objects, delegates, and retain cycles
- From: Grigory Entin <email@hidden>
- Date: Mon, 02 Oct 2006 04:00:20 +0400
Hello Derrick,
On Mon Oct 02 2006 at 01:42, Derrick Bass <email@hidden> wrote:
> I'm using Distributed Objects to perform a long operation in a
> separate process. The vended object communicates the operation's
> progress by calling a method in its delegate. The problem is that if
> the object doesn't retain the delegate then the proxy to it goes
> away, so its pointer becomes stale. On the other hand, if it does
> retain the delegate, the retain gets propagated back to the client;
> but the delegate happens to be the object that's retaining the
> vended object, so I get a retain cycle.
>
> Is there a good solution to this problem?
I'm not sure about other solutions, but when I faced the same problem,
I ended up with retaining the delegate (proxy) and creating the retain
cycle. I decided to follow one simple rule of thumb not to be affected
by the cycle: make the object that *sets* the delegate responsible for
resetting it to nil when appropriate (and therefore breaking the
retain cycle). It worked for me, and moreover, helped to keep the
model "clean".
Regards,
Grigory
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden