NSArrayController and managedObjectContext Problem

  • Hello list,

    I've been trying to track down the cause of an EXC_BAD_ACCESS I've
    been getting upon document closure.  Here is the set up --

    I have a custom view that is programmatically bound to the
    arrangedObjects of an array controller.  The array controller is
    bound to the managedObjectContext of my persistent document subclass
    in IB.  (No content binding, it just grabs all of the 'Cell' entities
    out of the moc).

    So here is what happens -- I start my application, and create one
    Cell object.  I save the document and quit the application.  All is
    fine.  I reopen that same document, do nothing to it, and attempt to
    close it.  The second I move the mouse, the program crashes with an
    EXC_BAD_ACCESS error.  Here is the stack:

    #0    0x90a61b09 in _objc_error
    #1    0x90a61b40 in __objc_error
    #2    0x90a601a0 in _freedHandler
    #3    0x927e0344 in -[NSObject(NSKeyValueObserverNotification)
    didChangeValueForKey:]
    #4    0x93cd2038 in -[NSManagedObject didChangeValueForKey:]
    #5    0x00009f46 in -[WBCell didChangeValueForKey:]
    #6    0x93cbd9c8 in -[NSFaultHandler turnObject:intoFaultWithContext:]
    #7    0x93cbd558 in -[NSManagedObjectContext(_NSInternalAdditions)
    _disposeObjects:count:notifyParent:]
    #8    0x93cbd067 in -[NSManagedObjectContext(_NSInternalAdditions)
    _dispose:]
    #9    0x93cbccf7 in -[NSManagedObjectContext dealloc]
    #10    0x937e874a in -[_NSManagedProxy setManagedObjectContext:]
    #11    0x937e861a in -[_NSManagedProxy dealloc]
    #12    0x937e6573 in -[NSObjectController _dealloc]
    #13    0x937df1a6 in -[NSArrayController _dealloc]
    #14    0x9353ff55 in -[NSController dealloc]
    #15    0x93847afc in -[NSAutounbinderBinding dealloc]
    #16    0x927d58cf in NSPopAutoreleasePool

    I know for a fact that all of the programmatic bindings with my
    custom view to the array controller are unbound (I do this in the
    dealloc method of the window controller for the custom view which is
    all getting called).  The only possible explanation I can see for
    this is that my array controller is still observing/trying to access
    values in the managed object context after it has been deallocated/
    all of the entities released.  How would this be?

    Sorry for the length of this post, this has been driving me nuts...

    Mike
previous month april 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Go to today
MindNode
MindNode offered a free license !