Prechádzať zdrojové kódy

Fix potential context resource leaks

There is a gap between the creation of the context and the call to
_glfwRefreshContextAttribs.
Camilla Berglund 9 rokov pred
rodič
commit
fcdef1d0a0
5 zmenil súbory, kde vykonal 5 pridanie a 5 odobranie
  1. 1 1
      src/cocoa_window.m
  2. 1 1
      src/mir_window.c
  3. 1 1
      src/win32_window.c
  4. 1 1
      src/wl_window.c
  5. 1 1
      src/x11_window.c

+ 1 - 1
src/cocoa_window.m

@@ -1069,7 +1069,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
     if (window->monitor)
         releaseMonitor(window);
 
-    if (window->context.client != GLFW_NO_API)
+    if (window->context.destroy)
         window->context.destroy(window);
 
     [window->ns.object setDelegate:nil];

+ 1 - 1
src/mir_window.c

@@ -396,7 +396,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
         window->mir.surface = NULL;
     }
 
-    if (window->context.client != GLFW_NO_API)
+    if (window->context.destroy)
         window->context.destroy(window);
 }
 

+ 1 - 1
src/win32_window.c

@@ -1026,7 +1026,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
     if (window->monitor)
         releaseMonitor(window);
 
-    if (window->context.client != GLFW_NO_API)
+    if (window->context.destroy)
         window->context.destroy(window);
 
     if (_glfw.win32.disabledCursorWindow == window)

+ 1 - 1
src/wl_window.c

@@ -437,7 +437,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
         _glfwInputWindowFocus(window, GLFW_FALSE);
     }
 
-    if (window->context.client != GLFW_NO_API)
+    if (window->context.destroy)
         window->context.destroy(window);
 
     if (window->wl.native)

+ 1 - 1
src/x11_window.c

@@ -1576,7 +1576,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
         window->x11.ic = NULL;
     }
 
-    if (window->context.client != GLFW_NO_API)
+    if (window->context.destroy)
         window->context.destroy(window);
 
     if (window->x11.handle)