]> granicus.if.org Git - handbrake/commitdiff
MacGui: do not use NSSecureCoding on 10.8, it crashes.
authorDamiano Galassi <damiog@gmail.com>
Fri, 21 Apr 2017 13:17:57 +0000 (15:17 +0200)
committerDamiano Galassi <damiog@gmail.com>
Fri, 21 Apr 2017 13:17:57 +0000 (15:17 +0200)
macosx/HBDistributedArray.m

index d56311244e1be14be0e31b46c24b42e6d92f3d67..26638216692b63643a6cacd32a0be3868b452610 100644 (file)
@@ -60,6 +60,7 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
 @property (nonatomic, readwrite) NSTimeInterval modifiedTime;
 
 @property (nonatomic, readonly) NSSet *objectClasses;
+@property (nonatomic, readonly) BOOL requiresSecureCoding;
 
 @property (nonatomic, readonly) sem_t *mutex;
 @property (nonatomic, readwrite) uint32_t mutexCount;
@@ -77,6 +78,12 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
         _array = [[NSMutableArray alloc] init];
         _objectClasses = [NSSet setWithObjects:[NSMutableArray class], objectClass, nil];
 
+        // Enable secure coding only on 10.9 and later
+        if ([NSURL instancesRespondToSelector:@selector(fileSystemRepresentation)])
+        {
+            _requiresSecureCoding = YES;
+        }
+
         NSString *identifier = [[NSBundle mainBundle] bundleIdentifier];
         NSArray *runningInstances = [NSRunningApplication runningApplicationsWithBundleIdentifier:identifier];
         const char *name = [NSString stringWithFormat:@"%@/%@", identifier, _fileURL.lastPathComponent.stringByDeletingPathExtension].UTF8String;
@@ -197,7 +204,7 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
     NSMutableArray *jobsArray = nil;
     @try
     {
-        if ([NSKeyedUnarchiver instancesRespondToSelector:@selector(requiresSecureCoding)])
+        if (self.requiresSecureCoding)
         {
             NSData *queue = [NSData dataWithContentsOfURL:self.fileURL];
             NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:queue];