Browse Source

【综合】转档偶发crash修复

tangchao 11 months ago
parent
commit
bad24f0ccd

+ 26 - 17
PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMConvertWindowController.swift

@@ -84,6 +84,8 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
     var excelContentOption: CPDFConvertExcelContentOptions?
     var excelWorksheetOption: CPDFConvertExcelWorksheetOptions?
     
+    private var fileAttri_: KMFileAttribute?
+    
     convenience init(documemtV:CPDFDocument, currentPage:CPDFPage, convertT:KMConvertType, handle:@escaping convertBatchCallBack) {
         self.init(windowNibName: "KMConvertWindowController")
         if (documemtV.documentURL != nil) {
@@ -366,7 +368,7 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
         self.updataView()
         
         self.prePDFView.go(to: currentPage)
-        let pageIndex = self.prePDFView.document.index(for: self.prePDFView.currentPage()!)+1
+        let pageIndex = self.prePDFView.currentPageIndex+1
         self.currentPageIndexTextField.stringValue = "\(pageIndex)"
         if let documentURL = self.pdfDocument?.documentURL{
             self.pdfDocument = CPDFDocument(url: documentURL)
@@ -374,6 +376,9 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
                 self.pdfDocument?.unlock(withPassword: lockPassword)
             }
             self.prePDFView.document = self.pdfDocument
+            
+            self.fileAttri_ = KMFileAttribute()
+            self.fileAttri_?.filePath = documentURL.path
         }
         self.prePDFView.setDisplay(.singlePage)
         self.prePDFView.layoutDocumentView()
@@ -691,15 +696,16 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
     @IBAction func buttonClicked_Convert(_ sender: Any) {
         self.window?.makeFirstResponder(self.prePDFView)
         if self.handInputButton.state == .on {
-            let fileAttribute = KMFileAttribute()
-            fileAttribute.pdfDocument = self.pdfDocument
-            fileAttribute.filePath = self.pdfDocument?.documentURL.path ?? ""
-            fileAttribute.bAllPage = false
-            if self.handInputButton.state == .on {
-                fileAttribute.pagesType = .custom
+            if self.fileAttri_ == nil {
+                self.fileAttri_ = KMFileAttribute()
+                self.fileAttri_?.filePath = self.pdfDocument?.documentURL.path ?? ""
             }
-            fileAttribute.pagesString = self.pageRangeTextField.stringValue
-            if fileAttribute.fetchSelectPages().isEmpty {
+//            fileAttri_.pdfDocument = self.pdfDocument
+            self.fileAttri_?.bAllPage = false
+            self.fileAttri_?.pagesType = .custom
+            self.fileAttri_?.pagesString = self.pageRangeTextField.stringValue
+            let pages = self.fileAttri_?.fetchSelectPages() ?? []
+            if pages.isEmpty {
                 return
             }
         }
@@ -964,15 +970,18 @@ let kConvertFileSavePath = (kTempSavePath?.stringByAppendingPathComponent("conve
             self.prePDFView.go(to: targetPage)
         } else if (object as AnyObject).isEqual(self.pageRangeTextField) == true {
             guard self.handInputButton.state == .on else { return }
-            let fileAttribute = KMFileAttribute()
-            fileAttribute.pdfDocument = self.pdfDocument
-            fileAttribute.filePath = self.pdfDocument?.documentURL.path ?? ""
-            fileAttribute.bAllPage = false
-            fileAttribute.pagesType = .custom
-            fileAttribute.pagesString = self.pageRangeTextField.stringValue
-            if fileAttribute.fetchSelectPages().count > 0 {
+            if self.fileAttri_ == nil {
+                self.fileAttri_ = KMFileAttribute()
+                self.fileAttri_?.filePath = self.pdfDocument?.documentURL.path ?? ""
+            }
+//            fileAttribute.pdfDocument = self.pdfDocument
+            self.fileAttri_?.bAllPage = false
+            self.fileAttri_?.pagesType = .custom
+            self.fileAttri_?.pagesString = self.pageRangeTextField.stringValue
+            let pages = self.fileAttri_?.fetchSelectPages() ?? []
+            if pages.count > 0 {
                 let pagesArray = NSMutableArray()
-                for pageNum in fileAttribute.fetchSelectPages() {
+                for pageNum in pages {
                     let tpage = self.pdfDocument?.page(at: UInt(pageNum - 1))
                     pagesArray.add(tpage as Any)
                 }

+ 6 - 0
PDF Office/PDF Master/Class/README.md

@@ -30,9 +30,15 @@
 - 【首页快捷工具】
 * KMOCRPDFWindowController
 
+## 转档
+* KMConvertWindowController
+
 ## 批量
 * KMBatchOperateWindowController
 
+## 图片转PDF
+* KMBatchOperateBaseWindowController
+
 ## 属性面板
 * KMGeneralAnnotationViewController
 

+ 106 - 26
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -404,22 +404,6 @@
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "DED67B5F-3AB6-40E6-BCFA-6324DF6C98E2"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/Batch/WindowController/KMBatchOperateLeftViewController.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "736"
-            endingLineNumber = "736"
-            landmarkName = "switchToOperateType(_:files:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -519,32 +503,128 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "DF9E846B-3A34-411F-9A22-6595FEA77E61"
+            uuid = "6D675012-EFBB-41A9-B66D-332EBFAF7DFD"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift"
+            filePath = "PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2927"
-            endingLineNumber = "2927"
-            landmarkName = "pdfListViewMenu(forEvent:for:click:isMoveSelectAnno:)"
+            startingLineNumber = "147"
+            endingLineNumber = "147"
+            landmarkName = "menuItemAction_find(_:)"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "6D675012-EFBB-41A9-B66D-332EBFAF7DFD"
+            uuid = "15CC1658-B67A-49EE-87AB-2873516F76BF"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift"
+            filePath = "PDF Master/Class/Common/Control/KMThumbnailView.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "147"
-            endingLineNumber = "147"
-            landmarkName = "menuItemAction_find(_:)"
+            startingLineNumber = "549"
+            endingLineNumber = "549"
+            landmarkName = "collectionView(_:validateDrop:proposedIndexPath:dropOperation:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "938B1F1B-DC26-4387-A6F0-CC9BA1F3CC70"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/KMPDFThumbnailView.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "207"
+            endingLineNumber = "207"
+            landmarkName = "collectionView(_:acceptDrop:indexPath:dropOperation:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "E2CE681F-C3E1-453F-A007-C97462998E3D"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/Common/Control/KMThumbnailView.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "527"
+            endingLineNumber = "527"
+            landmarkName = "collectionView(_:writeItemsAt:to:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "62BD71FC-3919-4565-AF78-4BABB1623E40"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "1467"
+            endingLineNumber = "1467"
+            landmarkName = "colorPickerViewAction(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "688C5B21-8FB3-4F40-B757-35A57439996D"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/EditPDF/KMEditPDFTextPropertyViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "260"
+            endingLineNumber = "260"
+            landmarkName = "initData()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "F8BF49BD-FBD4-42C9-B116-E14C4F724CFF"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/EditPDF/KMEditPDFTextPropertyViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "352"
+            endingLineNumber = "352"
+            landmarkName = "refreshSelectAreaProperty(needDefaultData:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "0335B273-434A-4538-B270-DA0A2859EB12"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/EditPDF/KMEditPDFTextPropertyViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "399"
+            endingLineNumber = "399"
+            landmarkName = "fontColorAction(_:)"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>