From 7f79543591f42833b384e3d34828bb42d721cac6 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Sun, 11 Jun 2017 08:37:19 +0200 Subject: [PATCH] Do not access UI item on a background thread. --- Classes/SBDocument.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Classes/SBDocument.m b/Classes/SBDocument.m index c9e020b..a508dd1 100644 --- a/Classes/SBDocument.m +++ b/Classes/SBDocument.m @@ -75,6 +75,8 @@ @property (nonatomic, strong) NSWindowController *sheetController; +@property (nonatomic, strong, nullable) NSDictionary *currentSaveAttributes; + @end @implementation SBDocument @@ -301,6 +303,7 @@ static NSDictionary *_detailMonospacedAttr; } }; + self.currentSaveAttributes = [self saveAttributes]; [self showProgressSheet]; [super saveToURL:url ofType:typeName forSaveOperation:saveOperation completionHandler:modifiedCompletionhandler]; } @@ -315,7 +318,6 @@ static NSDictionary *_detailMonospacedAttr; IOReturn io_success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, reasonForActivity, &assertionID); BOOL result = NO; - NSDictionary *options = [self saveAttributes]; __weak SBDocument *weakSelf = self; self.mp4.progressHandler = ^(double progress){ @@ -333,12 +335,12 @@ static NSDictionary *_detailMonospacedAttr; case NSSaveOperation: // movie file already exists, so we'll just update // the movie resource. - result = [self.mp4 updateMP4FileWithOptions:options error:outError]; + result = [self.mp4 updateMP4FileWithOptions:self.currentSaveAttributes error:outError]; break; case NSSaveAsOperation: // 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; default: