diff --git a/src/SFML/Window/OSX/SFApplication.m b/src/SFML/Window/OSX/SFApplication.m index 3c98d215..bee92f80 100644 --- a/src/SFML/Window/OSX/SFApplication.m +++ b/src/SFML/Window/OSX/SFApplication.m @@ -35,6 +35,8 @@ //////////////////////////////////////////////////////////// +(void)processEvent +{ +@autoreleasepool { [SFApplication sharedApplication]; // Make sure NSApp exists NSEvent* event = nil; @@ -46,6 +48,7 @@ { [NSApp sendEvent:event]; } +} // pool } diff --git a/src/SFML/Window/OSX/SFContext.mm b/src/SFML/Window/OSX/SFContext.mm index 8f79f33a..0feaf645 100644 --- a/src/SFML/Window/OSX/SFContext.mm +++ b/src/SFML/Window/OSX/SFContext.mm @@ -90,7 +90,13 @@ m_window(0) //////////////////////////////////////////////////////////// SFContext::~SFContext() { +@autoreleasepool { [m_context clearDrawable]; + + m_context = nil; + m_view = nil; + m_window = nil; +} // pool } @@ -122,6 +128,8 @@ void SFContext::setVerticalSyncEnabled(bool enabled) void SFContext::createContext(SFContext* shared, unsigned int bitsPerPixel, const ContextSettings& settings) +{ +@autoreleasepool { // Choose the attributes of OGL context. std::vector attrs; @@ -195,6 +203,7 @@ void SFContext::createContext(SFContext* shared, // Save the settings. (OpenGL version is updated elsewhere.) m_settings = settings; +} // pool } } // namespace priv diff --git a/src/SFML/Window/OSX/SFOpenGLView.mm b/src/SFML/Window/OSX/SFOpenGLView.mm index cb66553d..ad7bbd77 100644 --- a/src/SFML/Window/OSX/SFOpenGLView.mm +++ b/src/SFML/Window/OSX/SFOpenGLView.mm @@ -293,6 +293,10 @@ BOOL isValidTextUnicode(NSEvent* event); [self removeTrackingArea:m_trackingArea]; [self setRequesterTo:0]; + + m_hiddenTextView = nil; + m_silentResponder = nil; + m_trackingArea = nil; } diff --git a/src/SFML/Window/OSX/SFViewController.mm b/src/SFML/Window/OSX/SFViewController.mm index fb64f618..05e9dc94 100644 --- a/src/SFML/Window/OSX/SFViewController.mm +++ b/src/SFML/Window/OSX/SFViewController.mm @@ -81,6 +81,9 @@ -(void)dealloc { [self closeWindow]; + + m_view = nil; + m_oglView = nil; } diff --git a/src/SFML/Window/OSX/SFWindowController.mm b/src/SFML/Window/OSX/SFWindowController.mm index b76f6203..63b8454d 100644 --- a/src/SFML/Window/OSX/SFWindowController.mm +++ b/src/SFML/Window/OSX/SFWindowController.mm @@ -254,6 +254,8 @@ [self closeWindow]; [NSMenu setMenuBarVisible:YES]; + m_window = nil; + m_oglView = nil; delete m_fullscreenMode; } diff --git a/src/SFML/Window/OSX/WindowImplCocoa.mm b/src/SFML/Window/OSX/WindowImplCocoa.mm index 909146a2..8d0a176c 100644 --- a/src/SFML/Window/OSX/WindowImplCocoa.mm +++ b/src/SFML/Window/OSX/WindowImplCocoa.mm @@ -48,6 +48,8 @@ namespace priv //////////////////////////////////////////////////////////// WindowImplCocoa::WindowImplCocoa(WindowHandle handle) : m_showCursor(true) +{ +@autoreleasepool { // Treat the handle as it real type id nsHandle = (__bridge id)handle; @@ -78,6 +80,7 @@ m_showCursor(true) // Finally, set up keyboard helper initialiseKeyboardHelper(); +} // pool } @@ -87,6 +90,8 @@ WindowImplCocoa::WindowImplCocoa(VideoMode mode, unsigned long style, const ContextSettings& /*settings*/) : m_showCursor(true) +{ +@autoreleasepool { // Transform the app process. setUpProcess(); @@ -97,18 +102,23 @@ m_showCursor(true) // Finally, set up keyboard helper initialiseKeyboardHelper(); +} // pool } //////////////////////////////////////////////////////////// WindowImplCocoa::~WindowImplCocoa() +{ +@autoreleasepool { [m_delegate closeWindow]; + m_delegate = nil; // Put the next window in front, if any. NSArray* windows = [NSApp orderedWindows]; if ([windows count] > 0) [[windows objectAtIndex:0] makeKeyAndOrderFront:nil]; +} // pool }