Re: Remove action on NSArrayController bound to table causes index beyond bounds
Re: Remove action on NSArrayController bound to table causes index beyond bounds
- Subject: Re: Remove action on NSArrayController bound to table causes index beyond bounds
- From: Luke Evans <email@hidden>
- Date: Tue, 24 Mar 2009 01:56:28 -0700
Mmm... well, I'm coming around to the idea that something about my
model might be getting screwed before the index out of range
exceptions (though these still happen under the specific conditions
noted).
However, I can reproduce the Core Data fault error when the managed
objects in the table have no relationships to others (i.e. I don't
create any of the possible relationship objects).
So, I'm just adding and deleting 'root' objects that happen to be
represented by a row, with no other objects attached (those
relationships are properly set up w.r.t. deletion, but there shouldn't
be any references there to 'dangle' as dodgy faults even if this
wasn't the case).
There are a couple of places that make reference to the managed
objects that are bound to the rows, so its possible that the "remove:"
on the array controller is causing Core Data to do some deletion of
the managed object, but it is still referenced from a few places
temporarily (for instance I have an "anchor selection" concept in a
'selection coordinator' that maintains a notion of the single selected
object in the entire app that will appear in an 'inspector'). I can't
think why this would cause a problem, and I'm in a pure GC environment
w.r.t. those references). The core data faulting error definitely
seems to occur when the model is saved.
The only slightly odd thing I can conceive of (at the moment) is an
undo group bracketing the remove: and a 'completion' method that
occurs soon after the remove: as a delayed message from the run loop.
This is so I can give an undo name to the removal operation without
two undo registrations (one when remove: is called) and one when the
actual work happens on another run loop cycle (as documented for the
remove: action on NSArrayController). This seems to work, and I don't
believe undo groupings should have any effect on the actual model
operations - but could the grouping affect some aspect of the
'deletion' process?
-- lwe
On 24-Mar-09, at 12:27 AM, Luke Evans wrote:
Check your Managed Object Model. You most likely have a
relationship problem. Specifically, scrutinize your deletion rules
on all relationships.
Thanks. Well, as far as I can tell the model is in good shape,
deletion rules are what I expect (and I have no "No Action" anywhere).
_______________________________________________
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