• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: IB crash with custom binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: IB crash with custom binding
      • From: mmalcolm crawford <email@hidden>
    • Re: IB crash with custom binding
      • From: "Sean McBride" <email@hidden>
References: 
 >IB crash with custom binding (From: Ricky Sharp <email@hidden>)
 >Re: IB crash with custom binding (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: IB crash with custom binding
  • Next by Date: Re: IB crash with custom binding
  • Previous by thread: Re: IB crash with custom binding
  • Next by thread: Re: IB crash with custom binding
  • Index(es):
    • Date
    • Thread