Bladeren bron

【fix】悬浮窗字体名称列表双击crash修复

TangChao 7 maanden geleden
bovenliggende
commit
4d8d849646

+ 10 - 7
PDF Office/PDF Master/Class/Home/ViewController/customViewController/KMDesignSelect.swift

@@ -495,17 +495,20 @@ class KMSelectCell: NSTextFieldCell {
             }
             
             vc?.customBoxWidthLayoutConstraint.constant = width
-            vc?.downCallback = { [unowned self] (downEntered: Bool, count: String) -> Void in
+            vc?.downCallback = { [weak self] (downEntered: Bool, count: String) -> Void in
+                guard let blockSelf = self else {
+                    return
+                }
                 if downEntered {
-                    self.stringValue = count
+                    blockSelf.stringValue = count
                     
-                    let current = self.items.firstIndex(of: count) ?? 0
-                    self.indexOfSelectedItem = current
-                    self.delete?.km_comboBoxSelectionDidChange(self)
+                    let current = blockSelf.items.firstIndex(of: count) ?? 0
+                    blockSelf.indexOfSelectedItem = current
+                    blockSelf.delete?.km_comboBoxSelectionDidChange(blockSelf)
                     
-                    self.updateUI()
+                    blockSelf.updateUI()
                     
-                    self.createFilePopover.close()
+                    blockSelf.createFilePopover.close()
                 }
             }
             vc?.viewWillShow = { [weak self] cellView, idx in