Fix a hang when opening a document while another is begin saved.
This commit is contained in:
1 file changed
+7
-1
@@ -8,6 +8,7 @@
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
class DocumentController : NSDocumentController {
|
class DocumentController : NSDocumentController {
|
||||||
|
|
||||||
override func openDocument(withContentsOf url: URL, display displayDocument: Bool, completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void) {
|
override func openDocument(withContentsOf url: URL, display displayDocument: Bool, completionHandler: @escaping (NSDocument?, Bool, Error?) -> Void) {
|
||||||
let ext = url.pathExtension.lowercased()
|
let ext = url.pathExtension.lowercased()
|
||||||
|
|
||||||
@@ -26,6 +27,11 @@ class DocumentController : NSDocumentController {
|
|||||||
super.openDocument(withContentsOf: url, display: displayDocument, completionHandler: completionHandler)
|
super.openDocument(withContentsOf: url, display: displayDocument, completionHandler: completionHandler)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func document(for url: URL) -> NSDocument? {
|
||||||
|
let filteredDocuments = self.documents.filter { $0.fileURL == url }
|
||||||
|
return filteredDocuments.first
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NSApplicationMain
|
@NSApplicationMain
|
||||||
@@ -73,7 +79,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
let firstLaunch = defaults.bool(forKey: "SBFirstLaunch") ? false : true
|
let firstLaunch = defaults.bool(forKey: "SBFirstLaunch") ? false : true
|
||||||
|
|
||||||
let donateNagTime = Double(60 * 60 * 24 * 7)
|
let donateNagTime = Double(60 * 60 * 24 * 7)
|
||||||
let donateNagTimeLong = Double(60 * 60 * 24 * 120)
|
let donateNagTimeLong = Double(60 * 60 * 24 * 180)
|
||||||
|
|
||||||
let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
|
let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
|
||||||
let lastVersion = defaults.string(forKey: "SBDonateAskVersion") ?? ""
|
let lastVersion = defaults.string(forKey: "SBDonateAskVersion") ?? ""
|
||||||
|
|||||||
Reference in new issue
Block a user