From c1dcd29c71daca0db02e0158a87af54eac62b969 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 21 Oct 2012 21:30:13 +0200 Subject: [PATCH] Fixed potential clearing of wrong context. --- src/cocoa_window.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 1ecc9655..5625d41d 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -969,7 +969,9 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window) [window->NSGL.pixelFormat release]; window->NSGL.pixelFormat = nil; - [NSOpenGLContext clearCurrentContext]; + if ([NSOpenGLContext currentContext] == window->NSGL.context) + [NSOpenGLContext clearCurrentContext]; + [window->NSGL.context release]; window->NSGL.context = nil;