Fix a hang when opening a dragged file.

This commit is contained in:
Damiano Galassi committed 2015-05-02 15:35:06 +02:00
1 parent 18af7bce53
commit 8707239891
2 files changed
+10 -10

No files matched your search

+4 -2
View File
@@ -185,13 +185,15 @@
}
- (id)openDocumentWithContentsOfURL:(NSURL *)absoluteURL display:(BOOL)displayDocument error:(NSError **)outError {
SBDocument *doc = nil;
__block SBDocument *doc = nil;
if ([[[absoluteURL path] pathExtension] caseInsensitiveCompare: @"mkv"] == NSOrderedSame ||
[[[absoluteURL path] pathExtension] caseInsensitiveCompare: @"mka"] == NSOrderedSame ||
[[[absoluteURL path] pathExtension] caseInsensitiveCompare: @"mks"] == NSOrderedSame ||
[[[absoluteURL path] pathExtension] caseInsensitiveCompare: @"mov"] == NSOrderedSame) {
doc = [self openUntitledDocumentAndDisplay:displayDocument error:outError];
dispatch_sync(dispatch_get_main_queue(), ^{
doc = [self openUntitledDocumentAndDisplay:displayDocument error:outError];
});
[doc performSelectorOnMainThread:@selector(showImportSheet:) withObject:[NSArray arrayWithObject:absoluteURL] waitUntilDone:NO];
return doc;
}