Ver código fonte

【编辑工具】合并添加大纲crash修复

lizhe 6 meses atrás
pai
commit
1caae863a9

+ 13 - 13
PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/KMMergeWindowController.swift

@@ -213,22 +213,22 @@ extension KMMergeWindowController {
         
         
         let fileName = (files.first?.filePath.deletingPathExtension.lastPathComponent ?? "") + "_Merged"
-        DispatchQueue.main.async {
+//        DispatchQueue.main.async {
             if self.oldPDFDocument.outlineRoot() == nil {
                 self.oldPDFDocument.setNewOutlineRoot()
             }
             if allPage {
-//                var insertIndex = 0
-//                for i in 0..<rootPDFOutlineArray.count {
-//                    let rootOutline = rootPDFOutlineArray[i]
-//                    for j in 0..<rootOutline.numberOfChildren {
-//                        let outline = rootOutline.child(at: j)
-//                        if outline != nil {
-//                            self.oldPDFDocument.outlineRoot().insertChild(outline!, at: UInt(insertIndex))
-//                            insertIndex = insertIndex + 1
-//                        }
-//                    }
-//                }
+                var insertIndex = 0
+                for i in 0..<rootPDFOutlineArray.count {
+                    let rootOutline = rootPDFOutlineArray[i]
+                    for j in 0..<rootOutline.numberOfChildren {
+                        let outline = rootOutline.child(at: j)
+                        if outline != nil {
+                            self.oldPDFDocument.outlineRoot().insertChild(outline!, at: UInt(insertIndex))
+                            insertIndex = insertIndex + 1
+                        }
+                    }
+                }
             }
                 
                 self.handleReDraw()
@@ -327,7 +327,7 @@ extension KMMergeWindowController {
                     }
                 }
 //            }
-        }
+//        }
     }
     
     func fetchAllOfChildren(_ aOutline: CPDFOutline, containerArray aMArray: inout [CPDFOutline]) {