1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 12:18:51 -05:00

Cleanup of context clearing during window destruction.

This commit is contained in:
Camilla Berglund 2012-10-21 21:57:29 +02:00
parent b87157ccc1
commit 467d501621
5 changed files with 10 additions and 12 deletions

View File

@ -969,9 +969,6 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
[window->NSGL.pixelFormat release];
window->NSGL.pixelFormat = nil;
if ([NSOpenGLContext currentContext] == window->NSGL.context)
[NSOpenGLContext clearCurrentContext];
[window->NSGL.context release];
window->NSGL.context = nil;

View File

@ -528,11 +528,6 @@ int _glfwCreateContext(_GLFWwindow* window,
void _glfwDestroyContext(_GLFWwindow* window)
{
// This is duplicated from glfwDestroyWindow
// TODO: Stop duplicating code
if (window == _glfwCurrentWindow)
_glfwPlatformMakeContextCurrent(NULL);
if (window->WGL.context)
{
wglDeleteContext(window->WGL.context);

View File

@ -947,8 +947,16 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
// we're just creating an OpenGL 3.0+ context with the same pixel
// format, but it's not worth the added code complexity
// First we clear the current context (the one we just created)
// This is usually done by glfwDestroyWindow, but as we're not doing
// full window destruction, it's duplicated here
_glfwPlatformMakeContextCurrent(NULL);
// Next destroy the Win32 window and WGL context (without resetting or
// destroying the GLFW window object)
destroyWindow(window);
// ...and then create them again, this time with better APIs
if (!createWindow(window, wndconfig, fbconfig))
return GL_FALSE;
}

View File

@ -483,8 +483,8 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow handle)
if (window == NULL)
return;
// Clear the current context if this window's context is current
// TODO: Re-examine this in light of multithreading
// The window's context must not be current on another thread when the
// window is destroyed
if (window == _glfwPlatformGetCurrentContext())
_glfwPlatformMakeContextCurrent(NULL);

View File

@ -619,8 +619,6 @@ void _glfwDestroyContext(_GLFWwindow* window)
if (window->GLX.context)
{
// Release and destroy the context
glXMakeCurrent(_glfwLibrary.X11.display, None, NULL);
glXDestroyContext(_glfwLibrary.X11.display, window->GLX.context);
window->GLX.context = NULL;
}