From 2ce9e8e6b2362b8b6ec06a2a2b6a56a38ddf2172 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 24 Jun 2013 14:08:50 +0200 Subject: [PATCH] Fixed clipboard string leaks. The clipboard string was not by the Win32 and Cocoa ports on terminate. --- README.md | 2 ++ src/cocoa_init.m | 2 ++ src/win32_init.c | 2 ++ src/x11_init.c | 5 ++--- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b68e1be7..04685dab 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,8 @@ See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/). - Bugfix: The `-Wall` flag was not used with Clang and other GCC compatibles - Bugfix: The default for `GLFW_ALPHA_BITS` was set to zero + - [Win32] Bugfix: The clipboard string was not freed on terminate + - [Cocoa] Bugfix: The clipboard string was not freed on terminate - [X11] Bugfix: Override-redirect windows were resized to the desired instead of the actual resolution of the selected video mode diff --git a/src/cocoa_init.m b/src/cocoa_init.m index 6c9eeb0a..71425096 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -118,6 +118,8 @@ void _glfwPlatformTerminate(void) [_glfw.ns.cursor release]; _glfw.ns.cursor = nil; + free(_glfw.ns.clipboardString); + _glfwTerminateJoysticks(); _glfwTerminateContextAPI(); diff --git a/src/win32_init.c b/src/win32_init.c index e2725a1d..b5abf2a2 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -218,6 +218,8 @@ void _glfwPlatformTerminate(void) _glfw.win32.classAtom = 0; } + free(_glfw.win32.clipboardString); + _glfwTerminateContextAPI(); _glfwTerminateJoysticks(); diff --git a/src/x11_init.c b/src/x11_init.c index 98973b86..7d460ba3 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -628,14 +628,13 @@ void _glfwPlatformTerminate(void) _glfw.x11.cursor = (Cursor) 0; } + free(_glfw.x11.selection.string); + _glfwTerminateJoysticks(); _glfwTerminateContextAPI(); terminateDisplay(); - - if (_glfw.x11.selection.string) - free(_glfw.x11.selection.string); } const char* _glfwPlatformGetVersionString(void)