Browse Source

【fix】阅读页关闭加密窗口偶发crash修复

tangchao 8 months ago
parent
commit
80702e6a0d

+ 5 - 5
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -306,15 +306,15 @@ import Cocoa
         
         DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
             if self.view.window != nil && self.tabViewIsDragging() == false {
-                self.passwordWindow = KMPasswordInputWindow.openWindow(window: self.view.window!, url: self.document!.documentURL) { [unowned self] result , password in
+                self.passwordWindow = KMPasswordInputWindow.openWindow(window: self.view.window!, url: self.document!.documentURL) { [weak self] result , password in
                     if (result == .cancel) {
 //                        self.browserWindowController?.browser?.closeTab()
-                        (self.myDocument as? KMMainDocument)?.browser.closeTab()
+                        (self?.myDocument as? KMMainDocument)?.browser?.closeTab()
                         return
                     }
-                    self.model.isSaveKeyChain = true
-                    self.listView.document = self.document
-                    self.document?.unlock(withPassword: password)
+                    self?.model.isSaveKeyChain = true
+                    self?.listView?.document = self?.document
+                    self?.document?.unlock(withPassword: password)
                 }
             } else {
                 if self.model.needConvertNotes && self.tabViewIsDragging() == false {