summaryrefslogtreecommitdiffstats
path: root/macosx/HBDistributedArray.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2017-01-20 18:52:22 +0100
committerDamiano Galassi <[email protected]>2017-01-20 18:52:22 +0100
commita3d00959f42f940e8d3c2b73fb92a951cbf94472 (patch)
tree7085331974860d7771a3f6adaf1694383a1f064a /macosx/HBDistributedArray.m
parent40ec4ebaa2958b2549125dd525b6fcb2bd595d69 (diff)
MacGui: initial sandbox support. Added two new scheme RELEASE-SANDBOX and DEBUG-SANDBOX to build HandBrake with sandbox enabled.
Diffstat (limited to 'macosx/HBDistributedArray.m')
-rw-r--r--macosx/HBDistributedArray.m18
1 files changed, 8 insertions, 10 deletions
diff --git a/macosx/HBDistributedArray.m b/macosx/HBDistributedArray.m
index 8a9baef1d..d56311244 100644
--- a/macosx/HBDistributedArray.m
+++ b/macosx/HBDistributedArray.m
@@ -77,8 +77,9 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
_array = [[NSMutableArray alloc] init];
_objectClasses = [NSSet setWithObjects:[NSMutableArray class], objectClass, nil];
- NSArray *runningInstances = [NSRunningApplication runningApplicationsWithBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]];
- const char *name = [NSString stringWithFormat:@"/%@.hblock", _fileURL.lastPathComponent].UTF8String;
+ NSString *identifier = [[NSBundle mainBundle] bundleIdentifier];
+ NSArray *runningInstances = [NSRunningApplication runningApplicationsWithBundleIdentifier:identifier];
+ const char *name = [NSString stringWithFormat:@"%@/%@", identifier, _fileURL.lastPathComponent.stringByDeletingPathExtension].UTF8String;
// Unlink the semaphore if we are the only
// instance running, this fixes the case where
@@ -94,7 +95,7 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
_mutex = sem_open(name, O_CREAT, 0777, 1);
if (_mutex == SEM_FAILED)
{
- [HBUtilities writeToActivityLog:"%s: %d\n", "Error in creating semaphore: ", errno];
+ [HBUtilities writeToActivityLog:"%s: %d", "Error in creating semaphore: ", errno];
}
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:HBDistributedArraWrittenToDisk object:nil];
@@ -182,12 +183,9 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
{
if (!([notification.object integerValue] == getpid()))
{
- if ([notification.userInfo[@"path"] isEqualToString:self.fileURL.path])
- {
- [self lock];
- [self reload];
- [self unlock];
- }
+ [self lock];
+ [self reload];
+ [self unlock];
}
}
@@ -273,7 +271,7 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
// Send a distributed notification.
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:HBDistributedArraWrittenToDisk
object:[NSString stringWithFormat:@"%d", getpid()]
- userInfo:@{@"path": self.fileURL.path}
+ userInfo:nil
deliverImmediately:YES];
// Update the time, so we can avoid reloaded the file from disk later.