Fixed potential memory leaks on OS X
And renamed create* methods to new* to follow more closely Objective-C naming convention regarding memory management.
This commit is contained in:
parent
1dae89a8e0
commit
4f2c6c4489
@ -58,29 +58,29 @@
|
||||
NSMenu* mainMenu = [NSApp mainMenu];
|
||||
if (mainMenu != nil)
|
||||
return;
|
||||
mainMenu = [[NSMenu alloc] initWithTitle:@""];
|
||||
mainMenu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
|
||||
[NSApp setMainMenu:mainMenu];
|
||||
|
||||
// Application Menu (aka Apple Menu)
|
||||
NSMenuItem* appleItem = [mainMenu addItemWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
NSMenu* appleMenu = [[SFApplication createAppleMenu] autorelease];
|
||||
NSMenu* appleMenu = [[SFApplication newAppleMenu] autorelease];
|
||||
[appleItem setSubmenu:appleMenu];
|
||||
|
||||
// File Menu
|
||||
NSMenuItem* fileItem = [mainMenu addItemWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
NSMenu* fileMenu = [[SFApplication createFileMenu] autorelease];
|
||||
NSMenu* fileMenu = [[SFApplication newFileMenu] autorelease];
|
||||
[fileItem setSubmenu:fileMenu];
|
||||
|
||||
// Window menu
|
||||
NSMenuItem* windowItem = [mainMenu addItemWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
NSMenu* windowMenu = [[SFApplication createWindowMenu] autorelease];
|
||||
NSMenu* windowMenu = [[SFApplication newWindowMenu] autorelease];
|
||||
[windowItem setSubmenu:windowMenu];
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
+(NSMenu*)createAppleMenu
|
||||
+(NSMenu*)newAppleMenu
|
||||
{
|
||||
// Apple menu is as follow:
|
||||
//
|
||||
@ -159,7 +159,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
+(NSMenu*)createFileMenu
|
||||
+(NSMenu*)newFileMenu
|
||||
{
|
||||
// The File menu is as follow:
|
||||
//
|
||||
@ -181,7 +181,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
+(NSMenu*)createWindowMenu
|
||||
+(NSMenu*)newWindowMenu
|
||||
{
|
||||
// The Window menu is as follow:
|
||||
//
|
||||
|
@ -188,7 +188,7 @@
|
||||
[m_window setIgnoresMouseEvents:NO];
|
||||
|
||||
// Create a master view containing our OpenGL view
|
||||
NSView* masterView = [[SFBlackView alloc] initWithFrame:windowRect];
|
||||
NSView* masterView = [[[SFBlackView alloc] initWithFrame:windowRect] autorelease];
|
||||
|
||||
if (masterView == nil)
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ void WindowImplCocoa::setUpProcess(void)
|
||||
|
||||
// Register an application delegate if there is none
|
||||
if (![[SFApplication sharedApplication] delegate])
|
||||
[NSApp setDelegate:[[SFApplicationDelegate alloc] init]];
|
||||
[NSApp setDelegate:[[[SFApplicationDelegate alloc] init] autorelease]];
|
||||
|
||||
// Create menus for the application (before finishing launching!)
|
||||
[SFApplication setUpMenuBar];
|
||||
|
Loading…
Reference in New Issue
Block a user