Pārlūkot izejas kodu

【Fix】appcent[PDF_Reader_Pro.KMMainViewController.changeFont(__C.NSFontManager) -> ()
KMMainViewController.swift, line 2573]

dinglingui 2 nedēļas atpakaļ
vecāks
revīzija
f705dfd48a

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

@@ -215,6 +215,9 @@ import Cocoa
     var srHanddler: KMSearchReplaceHanddler = KMSearchReplaceHanddler()
 
     deinit {
+        let fontManager = NSFontManager.shared
+        fontManager.target = nil
+
         NotificationCenter.default.removeObserver(self)
         
         self.listView.delegate = nil
@@ -2569,8 +2572,7 @@ extension KMMainViewController {
 extension KMMainViewController {
     func changeFont(_ sender: NSFontManager) {
         KMPrint("changeFont ...")
-        if ((self.listView.activeAnnotation?.isKind(of: CPDFFreeTextAnnotation.self)) != nil) {
-            let annotation: CPDFFreeTextAnnotation = self.listView.activeAnnotation as! CPDFFreeTextAnnotation
+        if let annotation = listView.activeAnnotation as? CPDFFreeTextAnnotation {
             var font = NSFont(name: annotation.fontName() ?? "Helvetica", size: (annotation.fontSize()) )
             font = sender.convert(font!)