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;