diff options
author | ritsuka <[email protected]> | 2014-11-24 19:20:11 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-11-24 19:20:11 +0000 |
commit | dd65c93d74873038e9ff06b00e34ad2198b2a17d (patch) | |
tree | 641cdf19c9c1f7148d67549f926f150d312d8b4f /macosx/HBPresetsManager.m | |
parent | 139dca1885050b6b3a5fb0b1608dab60e41dbad1 (diff) |
MacGui: added a missing retain, it caused a crash when selecting a new default preset if the old default was a default preset that had been deleted by they built-in presets upgrade.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6551 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBPresetsManager.m')
-rw-r--r-- | macosx/HBPresetsManager.m | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/macosx/HBPresetsManager.m b/macosx/HBPresetsManager.m index f7b532107..53f74d3e5 100644 --- a/macosx/HBPresetsManager.m +++ b/macosx/HBPresetsManager.m @@ -179,10 +179,7 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; } } - if (!node.isBuiltIn) - { - node.delegate = self; - } + node.delegate = self; return node; } @@ -293,14 +290,15 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; } /** - * Private method to select a new default - * when the default preset is deleted. + * Private method to select a new default after the default preset is deleted + * or when the built-in presets are regenerated. */ - (void)selectNewDefault { __block HBPreset *normalPreset = nil; __block HBPreset *firstUserPreset = nil; __block HBPreset *firstBuiltInPreset = nil; + __block BOOL defaultAlreadySetted = NO; // Search for a possibile new default preset // Try to use "Normal" or the first user preset. @@ -321,9 +319,16 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; firstUserPreset = obj; *stop = YES; } + + if ([obj isDefault]) { + defaultAlreadySetted = YES; + } }]; - if (normalPreset) + if (defaultAlreadySetted) { + return; + } + else if (normalPreset) { self.defaultPreset = normalPreset; normalPreset.isDefault = YES; @@ -397,20 +402,17 @@ NSString *HBPresetsChangedNotification = @"HBPresetsChangedNotification"; @selector(createAndroidTabletPreset), @selector(createW8PhonePreset) }; - + SEL regularPresets[] = { @selector(createNormalPreset), @selector(createHighProfilePreset)}; - + [self deleteBuiltInPresets]; [self loadPresetsForType:@"Regular" fromSel:regularPresets length:2]; [self loadPresetsForType:@"Devices" fromSel:devicesPresets length:10]; - if (self.defaultPreset == nil) - { - [self selectNewDefault]; - } - + // set a new Default preset + [self selectNewDefault]; [HBUtilities writeToActivityLog: "built in presets updated to build number: %d", [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue]]; } |