Fix a bug found by the static analyzer: We do not own this timer, and we were (technically) leaking it. We now correctly manage its lifetime.
authorPeter Hosey <hg@boredzo.org>
Sat Sep 26 17:36:19 2009 -0700 (2009-09-26)
changeset 44398e5827d639dc
parent 4438 e5ae95057b8f
child 4440 14c4abac0637
Fix a bug found by the static analyzer: We do not own this timer, and we were (technically) leaking it. We now correctly manage its lifetime.
Core/Source/GrowlApplication.h
Core/Source/GrowlApplication.m
     1.1 --- a/Core/Source/GrowlApplication.h	Sat Sep 26 17:36:08 2009 -0700
     1.2 +++ b/Core/Source/GrowlApplication.h	Sat Sep 26 17:36:19 2009 -0700
     1.3 @@ -10,7 +10,7 @@
     1.4  
     1.5  
     1.6  @interface GrowlApplication : NSApplication {
     1.7 -
     1.8 +	NSTimer *autoreleasePoolRefreshTimer;
     1.9  }
    1.10  
    1.11  @end
     2.1 --- a/Core/Source/GrowlApplication.m	Sat Sep 26 17:36:08 2009 -0700
     2.2 +++ b/Core/Source/GrowlApplication.m	Sat Sep 26 17:36:19 2009 -0700
     2.3 @@ -27,7 +27,7 @@
     2.4  - (void)run
     2.5  {
     2.6  	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     2.7 -	[[NSTimer scheduledTimerWithTimeInterval:30
     2.8 +	autoreleasePoolRefreshTimer = [[NSTimer scheduledTimerWithTimeInterval:30
     2.9  									  target:self
    2.10  									selector:@selector(resetAutoreleasePool:)
    2.11  									userInfo:nil
    2.12 @@ -35,6 +35,10 @@
    2.13  	[pool release];
    2.14  
    2.15  	[super run];
    2.16 +
    2.17 +	[autoreleasePoolRefreshTimer invalidate];
    2.18 +	[autoreleasePoolRefreshTimer release];
    2.19 +	autoreleasePoolRefreshTimer = nil;
    2.20  }
    2.21  
    2.22  @end