/* HBSecurityAccessToken.m $ This file is part of the HandBrake source code. Homepage: . It may be used under the terms of the GNU General Public License. */ #import "HBSecurityAccessToken.h" @interface HBSecurityAccessToken () @property (nonatomic, readonly) id object; @property (nonatomic, readonly) BOOL accessed; @end @implementation HBSecurityAccessToken - (instancetype)initWithObject:(id)object { self = [super init]; if (self) { _object = object; _accessed = [_object startAccessingSecurityScopedResource]; } return self; } + (instancetype)tokenWithObject:(id)object { return [[self alloc] initWithObject:object]; } - (void)dealloc { if (_accessed) { [_object stopAccessingSecurityScopedResource]; } } @end