Layer Backed WebView assertion failed CGGStackRestore crash on Google News page

Number:rdar://10030959 Date Originated:2011-08-26
Status:Open Resolved:
Product:Mac OS X Product Version:10.7.1
Classification:Crash Reproducible:Always
26-Aug-2011 12:03 PM Eric Wing:
'' and 'MacMini_Lion_10.7.1.spx' were successfully uploaded

26-Aug-2011 12:03 PM Eric Wing:
I am trying to get a layer backed WebView to work in an OpenGL app. (I want to put a web view on top of an OpenGL surface, either a CAOpenGLLayer hosted in a view or layer backed NSOpenGLView).

When I do this and go to the Google News page, I see messages in my console and it almost always leads to a crash with the message in the console:

unlockFocus called too many time.
Assertion failed: (s->stack->next != NULL), function CGGStackRestore, file Context/CGGStack.c, line 116.

Steps to Reproduce:
Attached is a simple modification to Apple's developer example called "Layer Backed OpenGL View". All I do is add a WebView in Interface Builder and check the enable layer backed mode. (In my real app, we use a CAOpenGLLayer and do all the layer hosting setup programmatically.)

Build and run the app. In the app, there is a button to enable layer backing which brings up the HUD. In the HUD is the WebView. It should open to Google.

Click on the link to the News page. Usually the page starts to load, and then I see a pause, some console messages appear, and then ultimately, the assertion error.

Expected Results:
Webview should render the requested page without console messages or crashes or errors. There shouldn't be a pause either.

Actual Results:
There is a pause. There is a crash/assertion error. I get output like the following:

2011-08-25 18:51:05.876 LayerBackedOpenGLView[12233:707] NSOpenGLView pixelFormat RendererID = 0102261a
DVFreeThread - CFMachPortCreateWithPort hack = 0xa4ab3b0, fPowerNotifyPort= 0xa4ab390
DVFreeThread - CFMachPortCreateWithPort hack = 0xa4b1760, fPowerNotifyPort= 0xa4afff0
2011-08-25 18:51:19.391 LayerBackedOpenGLView[12233:707] unlockFocus called too many time.
Assertion failed: (s->stack->next != NULL), function CGGStackRestore, file Context/CGGStack.c, line 116.



(Go to the downloads section of for the sample project.)


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!