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@7048 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
tkchin@webrtc.org 2014-09-03 22:53:34 +00:00
parent 609f987488
commit 5b83af49c1

View File

@ -23,12 +23,7 @@ void InitCocoaMultiThreading() {
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 @@ void InitCocoaMultiThreading() {
[NSThread detachNewThreadSelector:@selector(class)
toTarget:[NSObject class]
withObject:nil];
[hack drain];
}
assert([NSThread isMultiThreaded]);