Index: OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCocoa.mm
===================================================================
--- OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCocoa.mm (revision 10456)
+++ OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowCocoa.mm (revision 10887)
@@ -972,15 +972,8 @@
     NSOpenGLContext* sharedContext = NULL;
     
-    GraphicsWindowCocoa* graphicsWindowCocoa = dynamic_cast<GraphicsWindowCocoa*>(_traits->sharedContext);
-    if (graphicsWindowCocoa) 
-    {
-        sharedContext = graphicsWindowCocoa->getContext();
-    }
-    else
-    {
-        PixelBufferCocoa* pixelbuffer = dynamic_cast<PixelBufferCocoa*>(_traits->sharedContext);
-        if (pixelbuffer) {
-            sharedContext = pixelbuffer->getContext();
-        }
+    GraphicsHandleCocoa* graphicsHandleCocoa = dynamic_cast<GraphicsHandleCocoa*>(_traits->sharedContext);
+    if (graphicsHandleCocoa) 
+    {
+        sharedContext = graphicsHandleCocoa->getNSOpenGLContext();
     }
     
