Added some memory autorelease pools and nil'ify attribute
This commit is contained in:
parent
324d4a18e7
commit
f6c94451fb
@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
+(void)processEvent
|
+(void)processEvent
|
||||||
|
{
|
||||||
|
@autoreleasepool
|
||||||
{
|
{
|
||||||
[SFApplication sharedApplication]; // Make sure NSApp exists
|
[SFApplication sharedApplication]; // Make sure NSApp exists
|
||||||
NSEvent* event = nil;
|
NSEvent* event = nil;
|
||||||
@ -46,6 +48,7 @@
|
|||||||
{
|
{
|
||||||
[NSApp sendEvent:event];
|
[NSApp sendEvent:event];
|
||||||
}
|
}
|
||||||
|
} // pool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +90,13 @@ m_window(0)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SFContext::~SFContext()
|
SFContext::~SFContext()
|
||||||
{
|
{
|
||||||
|
@autoreleasepool {
|
||||||
[m_context clearDrawable];
|
[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,
|
void SFContext::createContext(SFContext* shared,
|
||||||
unsigned int bitsPerPixel,
|
unsigned int bitsPerPixel,
|
||||||
const ContextSettings& settings)
|
const ContextSettings& settings)
|
||||||
|
{
|
||||||
|
@autoreleasepool
|
||||||
{
|
{
|
||||||
// Choose the attributes of OGL context.
|
// Choose the attributes of OGL context.
|
||||||
std::vector<NSOpenGLPixelFormatAttribute> attrs;
|
std::vector<NSOpenGLPixelFormatAttribute> attrs;
|
||||||
@ -195,6 +203,7 @@ void SFContext::createContext(SFContext* shared,
|
|||||||
|
|
||||||
// Save the settings. (OpenGL version is updated elsewhere.)
|
// Save the settings. (OpenGL version is updated elsewhere.)
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
|
} // pool
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -293,6 +293,10 @@ BOOL isValidTextUnicode(NSEvent* event);
|
|||||||
[self removeTrackingArea:m_trackingArea];
|
[self removeTrackingArea:m_trackingArea];
|
||||||
|
|
||||||
[self setRequesterTo:0];
|
[self setRequesterTo:0];
|
||||||
|
|
||||||
|
m_hiddenTextView = nil;
|
||||||
|
m_silentResponder = nil;
|
||||||
|
m_trackingArea = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,6 +81,9 @@
|
|||||||
-(void)dealloc
|
-(void)dealloc
|
||||||
{
|
{
|
||||||
[self closeWindow];
|
[self closeWindow];
|
||||||
|
|
||||||
|
m_view = nil;
|
||||||
|
m_oglView = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -254,6 +254,8 @@
|
|||||||
[self closeWindow];
|
[self closeWindow];
|
||||||
[NSMenu setMenuBarVisible:YES];
|
[NSMenu setMenuBarVisible:YES];
|
||||||
|
|
||||||
|
m_window = nil;
|
||||||
|
m_oglView = nil;
|
||||||
delete m_fullscreenMode;
|
delete m_fullscreenMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@ namespace priv
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplCocoa::WindowImplCocoa(WindowHandle handle) :
|
WindowImplCocoa::WindowImplCocoa(WindowHandle handle) :
|
||||||
m_showCursor(true)
|
m_showCursor(true)
|
||||||
|
{
|
||||||
|
@autoreleasepool
|
||||||
{
|
{
|
||||||
// Treat the handle as it real type
|
// Treat the handle as it real type
|
||||||
id nsHandle = (__bridge id)handle;
|
id nsHandle = (__bridge id)handle;
|
||||||
@ -78,6 +80,7 @@ m_showCursor(true)
|
|||||||
|
|
||||||
// Finally, set up keyboard helper
|
// Finally, set up keyboard helper
|
||||||
initialiseKeyboardHelper();
|
initialiseKeyboardHelper();
|
||||||
|
} // pool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,6 +90,8 @@ WindowImplCocoa::WindowImplCocoa(VideoMode mode,
|
|||||||
unsigned long style,
|
unsigned long style,
|
||||||
const ContextSettings& /*settings*/) :
|
const ContextSettings& /*settings*/) :
|
||||||
m_showCursor(true)
|
m_showCursor(true)
|
||||||
|
{
|
||||||
|
@autoreleasepool
|
||||||
{
|
{
|
||||||
// Transform the app process.
|
// Transform the app process.
|
||||||
setUpProcess();
|
setUpProcess();
|
||||||
@ -97,18 +102,23 @@ m_showCursor(true)
|
|||||||
|
|
||||||
// Finally, set up keyboard helper
|
// Finally, set up keyboard helper
|
||||||
initialiseKeyboardHelper();
|
initialiseKeyboardHelper();
|
||||||
|
} // pool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplCocoa::~WindowImplCocoa()
|
WindowImplCocoa::~WindowImplCocoa()
|
||||||
|
{
|
||||||
|
@autoreleasepool
|
||||||
{
|
{
|
||||||
[m_delegate closeWindow];
|
[m_delegate closeWindow];
|
||||||
|
m_delegate = nil;
|
||||||
|
|
||||||
// Put the next window in front, if any.
|
// Put the next window in front, if any.
|
||||||
NSArray* windows = [NSApp orderedWindows];
|
NSArray* windows = [NSApp orderedWindows];
|
||||||
if ([windows count] > 0)
|
if ([windows count] > 0)
|
||||||
[[windows objectAtIndex:0] makeKeyAndOrderFront:nil];
|
[[windows objectAtIndex:0] makeKeyAndOrderFront:nil];
|
||||||
|
} // pool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user