NSSplitView outputs console errors in layer-backed view

Originator:mlilback
Number:rdar://11999422 Date Originated:7/31/2012
Status:Open Resolved:
Product:OS X Product Version:10.8
Classification:Other Bug Reproducible:Always
 
When loading a nssplitview from a nib into a layer-backed view/window, a lot of errors are spewed out on the console. 

Jul 31 17:03:21 Barney.local SplitViewBugTest[5317] <Error>: CGContextConcatCTM: invalid context 0x0
Jul 31 17:03:21 Barney.local SplitViewBugTest[5317] <Error>: CGContextGetCTM: invalid context 0x0
Jul 31 17:03:21 Barney.local SplitViewBugTest[5317] <Error>: CGContextGetDefaultUserSpaceToDeviceSpaceTransform: invalid context 0x0
Jul 31 17:03:21 Barney.local SplitViewBugTest[5317] <Error>: CGContextSaveGState: invalid context 0x0
Jul 31 17:03:21 Barney.local SplitViewBugTest[5317] <Error>: CGContextConcatCTM: invalid context 0x0
Jul 31 17:03:21 Barney.local SplitViewBugTest[5317] <Error>: CGContextDrawImages: invalid context 0x0
Jul 31 17:03:21 Barney.local SplitViewBugTest[5317] <Error>: CGContextDrawImage: invalid context 0x0
Jul 31 17:03:21 Barney.local SplitViewBugTest[5317] <Error>: CGContextRestoreGState: invalid context 0x0
2012-07-31 17:03:21.638 SplitViewBugTest[5317:303] Failed to create a CGColorRef from the NSColor NSPatternColorSpace <NSImage 0x10015e7f0 Size={10, 10} Reps=(
)> (this warning is only given once)

Attached is a sample project that shows this error. The nib with the splitview has auto-layout enabled and the window's content view is marked as requiring a layer.

Comments

Workaround

You can subclass NSSplitView and override drawDividerInRect: which works fine (so surely the bug must be simple to fix...).

You can get a decent starting point for a nice divider from BSSplitView:

http://www.bluestatic.org/source/?a=viewblob&p=MacGDBp&h=d3963a204dd9b8a9eac7bef9ffaf68342838710b&hb=d9e47f7935c52800fff2067ff3cf461c247aa726&f=Source/BSSplitView.m

Don't forget to also snarf or make your own dimple.png (

Be aware that code is GPL so avoid if that's an issue for your project. It's pretty simple to implement your own with NSGradient and a dimple image anyway.

+1

I get this as well on a project that was fine before upgrading to XCode DP3 and a new MPB with the retina display. Thought it might be a retina specific issue but tried my app on a regular MBP and got the same results.

BTW, the problem image is the one used by the NSSplitView to render the separator bar. The resulting separator is solid black.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!