Cleanup of context clearing during window destruction.

master
Camilla Berglund ago%!(EXTRA string=13 years)
parent b87157ccc1
commit 467d501621
  1. 3
      src/cocoa_window.m
  2. 5
      src/win32_opengl.c
  3. 8
      src/win32_window.c
  4. 4
      src/window.c
  5. 2
      src/x11_opengl.c

@ -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;

@ -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);

@ -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;
}

@ -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);

@ -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;
}

Loading…
Cancel
Save