From e3094d80d086b3654877fddd5f2c3187e6534f43 Mon Sep 17 00:00:00 2001 From: Donald Alan Morrison Date: Thu, 23 Aug 2012 13:41:54 -0700 Subject: [PATCH] Silenced LLVM SA Warning/Error regarding static singleton pattern. Added dealloc method. --- .../ios/Simulation/AccelerometerSimulation.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.m b/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.m index a9dc6f3363..2ff94fa02e 100644 --- a/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.m +++ b/cocos2dx/platform/ios/Simulation/AccelerometerSimulation.m @@ -67,6 +67,14 @@ static AccelerometerSimulation *sharedAccelerometer = NULL; @implementation AccelerometerSimulation +- (void) dealloc { + if (sharedAccelerometer) { + [sharedAccelerometer release]; + sharedAccelerometer = NULL; + } + [super dealloc]; +} + // this is straight from developer guide example for multi-threaded notifications - (void) setUpThreadingSupport { if ( notifications ) return; @@ -126,7 +134,7 @@ static AccelerometerSimulation *sharedAccelerometer = NULL; }; [notificationLock unlock]; } - +#ifndef __clang_analyzer__ + (AccelerometerSimulation *)getAccelerometer { if( sharedAccelerometer == NULL ) @@ -134,7 +142,7 @@ static AccelerometerSimulation *sharedAccelerometer = NULL; return sharedAccelerometer; } - +#endif - (void)threadLoop:(id)object { char buffer[1024];