From 8cb1442cc3b16a67c515bb3d1076d7eba4749b98 Mon Sep 17 00:00:00 2001 From: "tschmelcher@chromium.org" Date: Tue, 15 Jun 2010 21:49:12 +0000 Subject: Fix issue in Safari 5 on Mac OS X 10.6 on Mac Minis where drawInCGLContext/copyCGLContextForPixelFormat are called a second time during shutdown in certain hosting pages, causing an assert due to duplicate creation of the Renderer service. TEST=repeatedly launched/exiting the affected O3D app and verified no crash or other issue BUG=none Review URL: http://codereview.chromium.org/2740011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49835 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/plugin/mac/o3d_layer.mm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'o3d') diff --git a/o3d/plugin/mac/o3d_layer.mm b/o3d/plugin/mac/o3d_layer.mm index 194cc5e..a566f1b6 100644 --- a/o3d/plugin/mac/o3d_layer.mm +++ b/o3d/plugin/mac/o3d_layer.mm @@ -115,14 +115,16 @@ using o3d::DisplayWindowMac; * renderers from pixel format 'pixelFormat'. The default implementation * allocates a new context with a null share context. */ - (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat { - CGLContextObj share_context = obj_->GetFullscreenShareContext(); - DCHECK(share_context); - if (CGLCreateContext(pixelFormat, share_context, &glContext_) != - kCGLNoError) { - glContext_ = [super copyCGLContextForPixelFormat:pixelFormat]; + if (glContext_ == NULL) { + CGLContextObj share_context = obj_->GetFullscreenShareContext(); + DCHECK(share_context); + if (CGLCreateContext(pixelFormat, share_context, &glContext_) != + kCGLNoError) { + glContext_ = [super copyCGLContextForPixelFormat:pixelFormat]; + } + obj_->SetMacCGLContext(glContext_); + created_context_ = true; } - obj_->SetMacCGLContext(glContext_); - created_context_ = true; return glContext_; } -- cgit v1.1