Fix leak of NSAutoreleasePool.
This looks like something that's no longer applicable. From what I saw this code path isn't on a static initializer that runs before main. Should be okay to drain (release) pool outside of this scope.
BUG=3659
R=henrike@webrtc.org, jiayl@webrtc.org, noahric@chromium.org
Review URL: https://webrtc-codereview.appspot.com/13229004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7048 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/base/maccocoathreadhelper.mm b/base/maccocoathreadhelper.mm
index 7bf9e92..59ae6c4 100644
--- a/base/maccocoathreadhelper.mm
+++ b/base/maccocoathreadhelper.mm
@@ -23,12 +23,7 @@
if ([NSThread isMultiThreaded] == NO) {
// The sole purpose of this autorelease pool is to avoid a console
// message on Leopard that tells us we're autoreleasing the thread
- // with no autorelease pool in place; we can't set up an autorelease
- // pool before this, because this is executed from an initializer,
- // which is run before main. This means we leak an autorelease pool,
- // and one thread, and if other objects are set up in initializers after
- // this they'll be silently added to this pool and never released.
-
+ // with no autorelease pool in place.
// Doing NSAutoreleasePool* hack = [[NSAutoreleasePool alloc] init];
// causes unused variable error.
NSAutoreleasePool* hack;
@@ -36,6 +31,7 @@
[NSThread detachNewThreadSelector:@selector(class)
toTarget:[NSObject class]
withObject:nil];
+ [hack drain];
}
assert([NSThread isMultiThreaded]);