From fcdef1d0a0845c16f9db912f728753bfaabb4a5f Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 5 Aug 2016 11:22:55 +0200 Subject: [PATCH] Fix potential context resource leaks There is a gap between the creation of the context and the call to _glfwRefreshContextAttribs. --- src/cocoa_window.m | 2 +- src/mir_window.c | 2 +- src/win32_window.c | 2 +- src/wl_window.c | 2 +- src/x11_window.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 1db1f6a1..b002e997 100644 --- a/src/cocoa_window.m +++ b/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]; diff --git a/src/mir_window.c b/src/mir_window.c index 5380a884..411f906f 100644 --- a/src/mir_window.c +++ b/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); } diff --git a/src/win32_window.c b/src/win32_window.c index 6731b247..8e30eb64 100644 --- a/src/win32_window.c +++ b/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) diff --git a/src/wl_window.c b/src/wl_window.c index dc6e0db3..cf75ec82 100644 --- a/src/wl_window.c +++ b/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) diff --git a/src/x11_window.c b/src/x11_window.c index 918473c8..a7bcb605 100644 --- a/src/x11_window.c +++ b/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)