summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-11-24 19:20:11 +0000
committerritsuka <[email protected]>2014-11-24 19:20:11 +0000
commitdd65c93d74873038e9ff06b00e34ad2198b2a17d (patch)
tree641cdf19c9c1f7148d67549f926f150d312d8b4f /macosx
parent139dca1885050b6b3a5fb0b1608dab60e41dbad1 (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')
-rw-r--r--macosx/Controller.m2
-rw-r--r--macosx/HBPresetsManager.m30
2 files changed, 17 insertions, 15 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index a9f58c885..2e9b0dc24 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -81,7 +81,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
// we init the HBPresetsManager class
NSURL *presetsURL = [NSURL fileURLWithPath:[[HBUtilities appSupportPath] stringByAppendingPathComponent:@"UserPresets.plist"]];
presetManager = [[HBPresetsManager alloc] initWithURL:presetsURL];
- _selectedPreset = presetManager.defaultPreset;
+ _selectedPreset = [presetManager.defaultPreset retain];
// Workaround to avoid a bug in Snow Leopard
// we can switch back to [[NSApplication sharedApplication] applicationIconImage]
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]];
}