From 74ed35792ffe6391893ec5421e1f581a85af428f Mon Sep 17 00:00:00 2001 From: Patrick Snape Date: Mon, 8 Aug 2016 12:34:58 +0200 Subject: [PATCH] Cocoa: Add missing call to removeObserver: As noted in the documentation for NSDistributedNotificationCenter, (under the Discussion heading) before an observer is deallocated a call should be made to removeObserver: in order to ensure that the listener is correctly removed from all observation pools. Fixes #817. Closes #826. --- src/cocoa_init.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cocoa_init.m b/src/cocoa_init.m index 59943211..f10d638d 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -359,6 +359,8 @@ void _glfwPlatformTerminate(void) removeObserver:_glfw.ns.listener name:(__bridge NSString*)kTISNotifySelectedKeyboardInputSourceChanged object:nil]; + [[NSDistributedNotificationCenter defaultCenter] + removeObserver:_glfw.ns.listener]; [_glfw.ns.listener release]; _glfw.ns.listener = nil; }