Changeset 72

Show
Ignore:
Timestamp:
12/27/05 14:32:54 (3 years ago)
Author:
mrowe
Message:

Simplify memory management in -loadPreferences? and plug memory leaks in the process. Closes #33.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/PreferenceViews/EnvironmentView.m

    r41 r72  
    1111        path = [[NSString stringWithString:@"~/.MacOSX/environment.plist"] stringByExpandingTildeInPath]; 
    1212 
    13         environment = [[[NSMutableDictionary alloc] initWithContentsOfFile:path] autorelease]; 
    14         if(environment == nil) 
    15         { 
    16                 environment = [NSMutableDictionary dictionary]; 
    17         } 
    18  
    19         [environment retain]; 
     13        [environment release]; 
     14        environment = [[NSMutableDictionary alloc] initWithContentsOfFile:path]; 
     15        if (! environment) 
     16                environment = [[NSMutableDictionary alloc] init]; 
    2017 
    2118        /* Put all the environment variable names and put them into the environmentKeys array. */ 
    22         environmentKeys = [[NSMutableArray arrayWithArray:[environment allKeys]] retain]; 
    23         [environmentKeys retain]; 
     19        [environmentKeys release]; 
     20        environmentKeys = [[environment allKeys] mutableCopy]; 
    2421 
    2522        [manageGlobalEnvironment setState:[[NSUserDefaults standardUserDefaults] boolForKey:ManageGlobalEnvironmentString]];