Do not access UI item on a background thread.
This commit is contained in:
1 parent
df8050a136
commit
7f79543591
1 file changed
+5
-3
@@ -75,6 +75,8 @@
|
|||||||
|
|
||||||
@property (nonatomic, strong) NSWindowController *sheetController;
|
@property (nonatomic, strong) NSWindowController *sheetController;
|
||||||
|
|
||||||
|
@property (nonatomic, strong, nullable) NSDictionary<NSString *, NSNumber *> *currentSaveAttributes;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SBDocument
|
@implementation SBDocument
|
||||||
@@ -301,6 +303,7 @@ static NSDictionary *_detailMonospacedAttr;
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.currentSaveAttributes = [self saveAttributes];
|
||||||
[self showProgressSheet];
|
[self showProgressSheet];
|
||||||
[super saveToURL:url ofType:typeName forSaveOperation:saveOperation completionHandler:modifiedCompletionhandler];
|
[super saveToURL:url ofType:typeName forSaveOperation:saveOperation completionHandler:modifiedCompletionhandler];
|
||||||
}
|
}
|
||||||
@@ -315,7 +318,6 @@ static NSDictionary *_detailMonospacedAttr;
|
|||||||
IOReturn io_success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep,
|
IOReturn io_success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep,
|
||||||
kIOPMAssertionLevelOn, reasonForActivity, &assertionID);
|
kIOPMAssertionLevelOn, reasonForActivity, &assertionID);
|
||||||
BOOL result = NO;
|
BOOL result = NO;
|
||||||
NSDictionary<NSString *, NSNumber *> *options = [self saveAttributes];
|
|
||||||
|
|
||||||
__weak SBDocument *weakSelf = self;
|
__weak SBDocument *weakSelf = self;
|
||||||
self.mp4.progressHandler = ^(double progress){
|
self.mp4.progressHandler = ^(double progress){
|
||||||
@@ -333,12 +335,12 @@ static NSDictionary *_detailMonospacedAttr;
|
|||||||
case NSSaveOperation:
|
case NSSaveOperation:
|
||||||
// movie file already exists, so we'll just update
|
// movie file already exists, so we'll just update
|
||||||
// the movie resource.
|
// the movie resource.
|
||||||
result = [self.mp4 updateMP4FileWithOptions:options error:outError];
|
result = [self.mp4 updateMP4FileWithOptions:self.currentSaveAttributes error:outError];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSSaveAsOperation:
|
case NSSaveAsOperation:
|
||||||
// movie does not exist, create a new one from scratch.
|
// movie does not exist, create a new one from scratch.
|
||||||
result = [self.mp4 writeToUrl:url options:options error:outError];
|
result = [self.mp4 writeToUrl:url options:self.currentSaveAttributes error:outError];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in new issue
Block a user