Hi all,

I'm getting a weird exception, "Cannot perform operation without a
managed object context", with this backtrace:

#0  0x93d66e17 in objc_exception_throw ()
#1  0x9485beeb in +[NSException raise:format:arguments:] ()
#2  0x9485bf2a in +[NSException raise:format:] ()
#3  0x94de2ff5 in -[_NSManagedProxy _managedObjectContext] ()
#4  0x94de3026 in -[_NSManagedProxy _persistentStoreCoordinator] ()
#5  0x94de30b4 in -[_NSManagedProxy _entity] ()
#6  0x94de3379 in -[_NSManagedProxy fetchRequestWithSortDescriptors:limit:] ()
#7  0x94de26ee in -[NSObjectController(NSManagedController)
defaultFetchRequest] ()
#8  0x94de2a74 in -[NSObjectController(NSManagedController)
_executeFetch:didCommitSuccessfully:actionSender:] ()
#9  0x94f1203e in _NSSendCommitEditingSelector ()
#10 0x94cf8d54 in -[NSController _controllerEditor:didCommit:contextInfo:] ()
#11 0x94861a3d in __invoking___ ()
#12 0x94861428 in -[NSInvocation invoke] ()
#13 0x948614f8 in -[NSInvocation invokeWithTarget:] ()
#14 0x9006222e in __NSFireDelayedPerform ()
#15 0x947e2b25 in CFRunLoopRunSpecific ()
...

This happens when I close a window in my app, but only if I close it
_very_ soon after it is opened.  If I leave the window open for a few
100 ms then there is no problem.  My app is garbage collected.  The
exception is happening after windowWillClose.

The culprit seems to be an NSObjectController in the nib.  At this
point, nothing in my nib nor code even uses this objectController.  I
can stop the exception by doing one of two things:

a) remove it's binding to my document's moc.  Instead, I call
[myController setManagedObjectContext:...] in awakeFromNib.

b) change the 'prepares content' checkbox from on to off and instead
call [myController fetchWithRequest:nil merge:NO error:&error] in
windowDidLoad.

Anyone understand what's happening?  Does it sound like a Cocoa bug?

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 s...@rogue-research.com
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to