mirror of https://github.com/stella-emu/stella.git
Fix over-release.
Add autorelease around the Preferences methods.
This commit is contained in:
parent
1ecb8852de
commit
b489a61e03
|
@ -45,23 +45,26 @@ static Preferences *sharedInstance = nil;
|
|||
|
||||
- (id)init
|
||||
{
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
sharedInstance = self;
|
||||
if (self = [super init]) {
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
sharedInstance = self;
|
||||
}
|
||||
return(self);
|
||||
}
|
||||
|
||||
- (void)setString:(const char *)key : (const char *)value
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSString* theKey = [NSString stringWithCString:key encoding:NSASCIIStringEncoding];
|
||||
NSString* theValue = [NSString stringWithCString:value encoding:NSASCIIStringEncoding];
|
||||
|
||||
[defaults setObject:theValue forKey:theKey];
|
||||
[theKey release];
|
||||
[theValue release];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void)getString:(const char *)key : (char *)value : (int)size
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSString* theKey = [NSString stringWithCString:key encoding:NSASCIIStringEncoding];
|
||||
NSString* theValue = [defaults objectForKey:theKey];
|
||||
if (theValue != nil)
|
||||
|
@ -69,13 +72,14 @@ static Preferences *sharedInstance = nil;
|
|||
else
|
||||
value[0] = 0;
|
||||
|
||||
[theKey release];
|
||||
[theValue release];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void)save
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
[defaults synchronize];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1283,6 +1283,7 @@
|
|||
name = "«PROJECTNAMEASXML»";
|
||||
sourceTree = "<group>";
|
||||
tabWidth = 2;
|
||||
usesTabs = 0;
|
||||
};
|
||||
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
|
||||
isa = PBXGroup;
|
||||
|
|
Loading…
Reference in New Issue