Re: bindings duplicates object returned
Re: bindings duplicates object returned
- Subject: Re: bindings duplicates object returned
- From: Kyle Sluder <email@hidden>
- Date: Tue, 13 Dec 2011 10:47:19 -0800
On Tue, Dec 13, 2011 at 10:04 AM, Eric Slosser <email@hidden> wrote:
> I found the solution, and it's all my fault.
>
> The object 'foo' was meant to be a singleton instance of class 'Foo'. I always access it through [foo instance], which enforces that. After 'foo' is created, the nib is loaded in which the binding was expressed. In the process (see stack below**), -[Foo init] is called. My override of -[Foo init] didn't have singleton smarts, so I happily handed a different m_contents to the controller.
Don't be tempted to add singleton smarts to -[Foo init]. ARC will not
like them. Instead, add a property to File's Owner that just returns
the shared Foo instance.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden