CoreAnimation context error
CoreAnimation context error
- Subject: CoreAnimation context error
- From: James Farwell <email@hidden>
- Date: Sat, 27 Feb 2010 12:16:46 -0800
I am writing an application with a UI layout much like Address Book,
with two panes, a list on the left and a read/edit view on the right.
The the right pane is an NSScrollView and I have an "Edit" button
beneath it that swaps the document view between the read-only view and
the editing view. The read-only view is a layer-hosted CA view, the
editing view is just a set of controls with no CA. Modifying these
controls updates the underlying model, which in turn causes the CA
view to update its layout/contents via KVO. This works very nicely
except _sometimes_ when I switch from the editing view back to the CA
view I get the following exception:
2010-02-27 11:57:02.968 MyApp[5063:a0f] layer <CALayer: 0x1004e37b0>
is already attached to a context
With the following backtrace:
#0 0x00007fff857b60da in objc_exception_throw ()
#1 0x00007fff877cd267 in +[NSException raise:format:arguments:] ()
#2 0x00007fff877cd1f4 in +[NSException raise:format:] ()
#3 0x00007fff84c53541 in CA::Context::set_layer ()
#4 0x00007fff84ca5316 in CAViewSetLayer ()
#5 0x00007fff82b35af8 in -[NSView(NSInternal) _createLayerTreeRenderer] ()
#6 0x00007fff82b35882 in -[NSView(NSLayerKitGlue)
_setUpLayerTreeRendererAndSurface] ()
#7 0x00007fff828eebb7 in -[NSView _setWindow:] ()
#8 0x00007fff828f7a13 in -[NSView addSubview:] ()
#9 0x00007fff8293d24c in -[NSClipView setDocumentView:] ()
#10 0x00007fff8293cfe5 in -[NSScrollView setDocumentView:] ()
#11 0x000000010000193a in -[MyWindowController setEditing:]
(self=0x102e19db0, _cmd=0x7fff8309c6ef, newEditing=0 '\0') at
/Users/jfarwell/Projects/MyApp/MyWindowController.m:69
#12 <KVC stack from button bound to "editing" being pressed">
The -setEditing: method looks like:
- (void)setEditing: (BOOL)newEditing
{
if (editing == newEditing) {
return;
}
editing = newEditing;
rightPaneScrollView.documentView = editing ? editView : infoView;
}
Where infoView and editView are the CA layer-hosted view and the
controls view respectively.
I suspect that I am doing something monumentally bad or silly to cause
this exception, but I really don't know what. Can anyone help?
- James
_______________________________________________
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