Added some memory autorelease pools and nil'ify attribute
This commit is contained in:
parent
324d4a18e7
commit
f6c94451fb
@ -35,6 +35,8 @@
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
+(void)processEvent
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
[SFApplication sharedApplication]; // Make sure NSApp exists
|
||||
NSEvent* event = nil;
|
||||
@ -46,6 +48,7 @@
|
||||
{
|
||||
[NSApp sendEvent:event];
|
||||
}
|
||||
} // pool
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<NSOpenGLPixelFormatAttribute> attrs;
|
||||
@ -195,6 +203,7 @@ void SFContext::createContext(SFContext* shared,
|
||||
|
||||
// Save the settings. (OpenGL version is updated elsewhere.)
|
||||
m_settings = settings;
|
||||
} // pool
|
||||
}
|
||||
|
||||
} // namespace priv
|
||||
|
@ -293,6 +293,10 @@ BOOL isValidTextUnicode(NSEvent* event);
|
||||
[self removeTrackingArea:m_trackingArea];
|
||||
|
||||
[self setRequesterTo:0];
|
||||
|
||||
m_hiddenTextView = nil;
|
||||
m_silentResponder = nil;
|
||||
m_trackingArea = nil;
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,6 +81,9 @@
|
||||
-(void)dealloc
|
||||
{
|
||||
[self closeWindow];
|
||||
|
||||
m_view = nil;
|
||||
m_oglView = nil;
|
||||
}
|
||||
|
||||
|
||||
|
@ -254,6 +254,8 @@
|
||||
[self closeWindow];
|
||||
[NSMenu setMenuBarVisible:YES];
|
||||
|
||||
m_window = nil;
|
||||
m_oglView = nil;
|
||||
delete m_fullscreenMode;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user