Silenced LLVM SA Warning/Error regarding static singleton pattern. Added dealloc method.

This commit is contained in:
Donald Alan Morrison 2012-08-23 13:41:54 -07:00
parent 81d8dd0eb2
commit e3094d80d0
1 changed files with 10 additions and 2 deletions

View File

@ -67,6 +67,14 @@ static AccelerometerSimulation *sharedAccelerometer = NULL;
@implementation AccelerometerSimulation @implementation AccelerometerSimulation
- (void) dealloc {
if (sharedAccelerometer) {
[sharedAccelerometer release];
sharedAccelerometer = NULL;
}
[super dealloc];
}
// this is straight from developer guide example for multi-threaded notifications // this is straight from developer guide example for multi-threaded notifications
- (void) setUpThreadingSupport { - (void) setUpThreadingSupport {
if ( notifications ) return; if ( notifications ) return;
@ -126,7 +134,7 @@ static AccelerometerSimulation *sharedAccelerometer = NULL;
}; };
[notificationLock unlock]; [notificationLock unlock];
} }
#ifndef __clang_analyzer__
+ (AccelerometerSimulation *)getAccelerometer + (AccelerometerSimulation *)getAccelerometer
{ {
if( sharedAccelerometer == NULL ) if( sharedAccelerometer == NULL )
@ -134,7 +142,7 @@ static AccelerometerSimulation *sharedAccelerometer = NULL;
return sharedAccelerometer; return sharedAccelerometer;
} }
#endif
- (void)threadLoop:(id)object - (void)threadLoop:(id)object
{ {
char buffer[1024]; char buffer[1024];