Bug 923114 - Clear the current GL context when we're about to destroy it. r=mattwoodrow
authorMarkus Stange <mstange@themasta.com>
Wed, 09 Oct 2013 10:39:22 -0400
changeset 166414 30c25c68bb3edede082f5248f9ae6763ce8201bf
parent 166413 03f9c4191bf0b6b0a52bd4cbd8c1a837ff40f0dc
child 166415 fa082c3dc9930cc1a28cef1b9c9b8b3ebf207fa9
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs923114
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 923114 - Clear the current GL context when we're about to destroy it. r=mattwoodrow
gfx/gl/GLContextProviderCGL.mm
--- a/gfx/gl/GLContextProviderCGL.mm
+++ b/gfx/gl/GLContextProviderCGL.mm
@@ -98,18 +98,26 @@ public:
     {
         SetProfileVersion(ContextProfile::OpenGLCompatibility, 210);
     }
 
     ~GLContextCGL()
     {
         MarkDestroyed();
 
-        if (mContext)
+        if (mContext) {
+            if ([NSOpenGLContext currentContext] == mContext) {
+                // Clear the current context before releasing. If we don't do
+                // this, the next time we call [NSOpenGLContext currentContext],
+                // "invalid context" will be printed to the console.
+                [NSOpenGLContext clearCurrentContext];
+            }
             [mContext release];
+        }
+
     }
 
     GLContextType GetContextType() {
         return ContextTypeCGL;
     }
 
     bool Init()
     {