Re: NSIndexSet isEqual: sent to deallocated instance
Re: NSIndexSet isEqual: sent to deallocated instance
- Subject: Re: NSIndexSet isEqual: sent to deallocated instance
- From: Gordon Apple <email@hidden>
- Date: Wed, 08 Oct 2008 13:35:47 -0500
- Thread-topic: NSIndexSet isEqual: sent to deallocated instance
The question I would ask is if you are using a KVC compliant method when
"Under some circumstances the the backing array is refreshed with new
content". Otherwise, the changes might not be registered everywhere they
need to be.
NSIndexSet is a non-mutable object that gets replaced whenever you change
it. If the above is true, it could be trying to access an NSIndexSet that
has been replaced and the old (referenced) one has been deallocated. Since
that might not happen immediately, that could explain the the randomness in
the reported error.
On 10/8/08 12:49 PM, "email@hidden"
<email@hidden> wrote:
> Message: 4
> Date: Wed, 08 Oct 2008 11:48:56 -0500
> From: Steve Cronin <email@hidden>
> Subject: NSIndexSet isEqual: sent to deallocated instance
> To: Cocoa-Dev List <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
> Folks;
>
> I have two custom tableViews and two custom arrayControllers.
> The reasons for the custom objects are so the UI can respond to
> specific key events and for drag and drop support.
> Both tableView have their appropriate arrayControllers designated as
> delegates and datasources.
> The tableViews use bindings to define the column values.
> The selection in one tableView controls the content of the other -
> this is implemented by using 'filteredArray' against a 'backing' array.
> Overall, this is largely working pretty well.
>
> Under some circumstances the the backing array is refreshed with new
> content.
> When this happens, sometimes, not always, an error is thrown:
> *** -[NSIndexSet isEqual:]: message sent to deallocated instance
> 0x184de440
> #0 0x92028907 in ___forwarding___
> #1 0x92028a12 in __forwarding_prep_0___
> #2 0x967fadb9 in _NSValuesAreEqual
> #3 0x9683e9e6 in -[NSTableBinder _updateSelectionIndexes:]
> #4 0x9683e073 in -[NSTableBinder
> _observeValueForKeyPath:ofObject:context:]
> #5 0x9683dd6d in -[NSTableBinder
> observeValueForKeyPath:ofObject:change:context:]
> #6 0x93d77ece in NSKVONotify
> #7 0x93d08465 in -[NSObject(NSKeyValueObservingPrivate)
> _notifyObserversForKeyPath:change:]
> #8 0x9661cd7a in -[NSController _notifyObserversForKeyPath:change:]
> #9 0x9661cc7b in -[NSController didChangeValueForKey:]
> #10 0x96838ce4 in -[NSArrayController
> didChangeValuesForArrangedKeys:objectKeys:indexKeys:]
> #11 0x9683bb44 in -[NSArrayController
> _arrangeObjectsWithSelectedObjects:avoidsEmptySelection:operationsMask:useBasi
> s
> :]
> #12 0x96836a7a in -[NSArrayController setContent:]
> #13 0x9683d2a2 in -[NSArrayDetailBinder
> _refreshDetailContentInBackground:]
> #14 0x93d77ece in NSKVONotify
> #15 0x93cf4392 in -[NSObject(NSKeyValueObserverNotification)
> didChangeValueForKey:]
> #16 0x000cb3a9 in -[MyWindowController refreshViews] at
> MyWindowController.m:347
>
> I do not have either tableViews 'selectionIndexes' bound.
> I'm puzzled by the intermittent nature and, as with all binding
> related errors, find it simply maddening to try and debug.
> I can't seem to 'step' my way up/into the error, it is tripped
> somewhere in 'binding space'...
>
> Does anyone have any useful feedback?
> (10.5 SDk deploy target 10.4)
>
> Thanks,
> Steve
G. Apple
_______________________________________________
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