Re: IB crash with custom binding
Re: IB crash with custom binding
- Subject: Re: IB crash with custom binding
- From: Ricky Sharp <email@hidden>
- Date: Wed, 23 Feb 2005 14:40:38 -0600
On Wednesday, February 23, 2005, at 02:26PM, Sean McBride <email@hidden> wrote:
>On 2005-02-23 14:13, Ricky Sharp said:
>
>>Any pointers would be greatly appreciated.
>
>This is a wild guess, but:
><http://homepage.mac.com/mmalc/CocoaExamples/controllers.html#ibBindings>
Thanks, but I already saw that note. I do call through to super's implementation of both bind and unbind.
I think I've tracked the problem down. I was getting a bit fancy by providing accessors for observedObjectForBaseColor (id) and observedKeyPathForBaseColor (NSString). Basically, these are set up in bind: and torn down in unbind:
The accessors were simply:
- (id)observedObjectForBaseColor
{
return observedObjectForBaseColor;
}
- (void)setObservedObjectForBaseColor:(id)newObservedObjectForBaseColor
{
observedKeyPathForBaseColor = newObservedObjectForBaseColor;
}
- (NSString *)observedKeyPathForBaseColor
{
return observedKeyPathForBaseColor;
}
- (void)setObservedKeyPathForBaseColor:(NSString *)newObservedKeyPathForBaseColor
{
if (observedKeyPathForBaseColor != newObservedKeyPathForBaseColor) {
[observedKeyPathForBaseColor release];
observedKeyPathForBaseColor = [newObservedKeyPathForBaseColor copy];
}
}
But rather than calling these, I now do this in bind..
observedObjectForBaseColor = anObservableController;
observedKeyPathForBaseColor = [aKeyPath copy];
and this in unbind...
observedObjectForBaseColor = nil;
[observedKeyPathForBaseColor release];
observedKeyPathForBaseColor = nil;
Previously, it was like this:
[self setObservedObjectForBaseColor:anObservableController];
[self setObservedKeyPathForBaseColor:aKeyPath];
and
[self setObservedObjectForBaseColor:nil];
[self setObservedKeyPathForBaseColor:nil];
Perhaps I've been staring at this code for too long, but aren't the accessor implementations doing the same exact thing as what I'm now doing (i.e. directly setting values)?
But anyhow, I've now done my open nib, test, quit exercise a few dozen times and cannot get any more crashes. Strange.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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