summaryrefslogtreecommitdiffstats
path: root/macosx/HBDistributedArray.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2017-04-21 15:17:57 +0200
committerDamiano Galassi <[email protected]>2017-04-21 15:17:57 +0200
commitbd88ea0594b35be21a47a0734a14f6dbcb5b7418 (patch)
tree96d237ae6b57c457e71b91201ace9554889f5b1c /macosx/HBDistributedArray.m
parent2cda3db7473c5751a9e785269ad43a76bbc34de6 (diff)
MacGui: do not use NSSecureCoding on 10.8, it crashes.
Diffstat (limited to 'macosx/HBDistributedArray.m')
-rw-r--r--macosx/HBDistributedArray.m9
1 files changed, 8 insertions, 1 deletions
diff --git a/macosx/HBDistributedArray.m b/macosx/HBDistributedArray.m
index d56311244..266382166 100644
--- a/macosx/HBDistributedArray.m
+++ b/macosx/HBDistributedArray.m
@@ -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];