bug 559075 - add local autorelease pool to SetupMacApplicationDelegate to prevent startup leakage. r=josh

This commit is contained in:
Jonathan Kew 2010-04-13 21:37:07 +01:00
parent 9448cba17e
commit 6c0909b348

View File

@ -92,6 +92,10 @@ SetupMacApplicationDelegate()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
// this is called during startup, outside an event loop, and therefore
// needs an autorelease pool to avoid cocoa object leakage (bug 559075)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// This call makes it so that application:openFile: doesn't get bogus calls
// from Cocoa doing its own parsing of the argument string. And yes, we need
// to use a string with a boolean value in it. That's just how it works.
@ -102,6 +106,8 @@ SetupMacApplicationDelegate()
MacApplicationDelegate *delegate = [[MacApplicationDelegate alloc] init];
[[NSApplication sharedApplication] setDelegate:delegate];
[pool release];
NS_OBJC_END_TRY_ABORT_BLOCK;
}