diff options
author | Damiano Galassi <[email protected]> | 2017-01-25 11:03:00 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2017-01-25 11:03:00 +0100 |
commit | 178071e0ce842af53e8c51e6275e8956fc4aa27c (patch) | |
tree | 6337430f7ec1900ce562bf394954469cc68b80d2 /macosx/HBCore.m | |
parent | 79c33c0ca996311224bbd3719c85238a3358cb5e (diff) |
MacGui: improve management of security scoped resources. Fix external SRT in the sandboxed build.
Diffstat (limited to 'macosx/HBCore.m')
-rw-r--r-- | macosx/HBCore.m | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/macosx/HBCore.m b/macosx/HBCore.m index dbce136f6..7e9024b47 100644 --- a/macosx/HBCore.m +++ b/macosx/HBCore.m @@ -12,6 +12,7 @@ #import "HBStateFormatter+Private.h" #import "HBTitle+Private.h" +#import "HBJob+Private.h" #include <dlfcn.h> @@ -243,13 +244,8 @@ typedef void (^HBCoreCleanupHandler)(); NSAssert(url, @"[HBCore scanURL:] called with nil url."); #ifdef __SANDBOX_ENABLED__ - BOOL accessingSecurityScopedResource = [url startAccessingSecurityScopedResource]; - self.cleanupHandler = ^{ - if (accessingSecurityScopedResource) - { - [url stopAccessingSecurityScopedResource]; - } - }; + __block HBSecurityAccessToken *token = [HBSecurityAccessToken tokenWithObject:url]; + self.cleanupHandler = ^{ token = nil; }; #endif // Reset the titles array @@ -509,8 +505,8 @@ typedef void (^HBCoreCleanupHandler)(); #ifdef __SANDBOX_ENABLED__ HBJob *jobCopy = [job copy]; - [jobCopy startAccessingSecurityScopedResource]; - self.cleanupHandler = ^{ [jobCopy stopAccessingSecurityScopedResource]; }; + __block HBSecurityAccessToken *token = [HBSecurityAccessToken tokenWithObject:jobCopy]; + self.cleanupHandler = ^{ token = nil; }; #endif // Add the job to libhb |