Commit 86027501 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed a leak in the Apple Remote class

parent f83ba044
...@@ -108,6 +108,7 @@ The class is not thread safe ...@@ -108,6 +108,7 @@ The class is not thread safe
IBOutlet id delegate; IBOutlet id delegate;
} }
+ (AppleRemote *)sharedInstance;
- (int) remoteId; - (int) remoteId;
......
...@@ -65,8 +65,19 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4; ...@@ -65,8 +65,19 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
#pragma public interface #pragma public interface
- (id) init { static AppleRemote *_o_sharedInstance = nil;
if(( self = [super init])) {
+ (AppleRemote *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
- (id)init
{
if (_o_sharedInstance) {
[self dealloc];
} else {
_o_sharedInstance = [super init];
openInExclusiveMode = YES; openInExclusiveMode = YES;
queue = NULL; queue = NULL;
hidDeviceInterface = NULL; hidDeviceInterface = NULL;
...@@ -124,13 +135,13 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4; ...@@ -124,13 +135,13 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
[cookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonPlay] forKey:@"33_21_20_8_2_33_21_20_8_2_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonPlay] forKey:@"33_21_20_8_2_33_21_20_8_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonFullscreen] forKey:@"33_21_20_3_2_33_21_20_3_2_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonFullscreen] forKey:@"33_21_20_3_2_33_21_20_3_2_"];
} }
}
/* defaults */ /* defaults */
[self setSimulatesPlusMinusHold: YES]; [self setSimulatesPlusMinusHold: YES];
maxClickTimeDifference = DEFAULT_MAXIMUM_CLICK_TIME_DIFFERENCE; maxClickTimeDifference = DEFAULT_MAXIMUM_CLICK_TIME_DIFFERENCE;
}
return self; return _o_sharedInstance;
} }
- (void) dealloc { - (void) dealloc {
......
...@@ -516,8 +516,9 @@ static VLCPrefs *_o_sharedMainInstance = nil; ...@@ -516,8 +516,9 @@ static VLCPrefs *_o_sharedMainInstance = nil;
- (id)initWithConfigItem: (module_config_t *) configItem - (id)initWithConfigItem: (module_config_t *) configItem
{ {
NSString * name = [[[VLCMain sharedInstance] localizedString:configItem->psz_name] autorelease]; NSString * name = [[VLCMain sharedInstance] localizedString:configItem->psz_name];
self = [super initWithName:name]; self = [super initWithName:name];
[name release];
if( self != nil ) if( self != nil )
{ {
_configItem = configItem; _configItem = configItem;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment