Revision: 12380
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12380&view=rev
Author:   hofman
Date:     2008-01-08 17:47:13 -0800 (Tue, 08 Jan 2008)

Log Message:
-----------
Avoid using NSFileManager on secondary thread.

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m       2008-01-09 
01:34:18 UTC (rev 12379)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVPDFIcon.m       2008-01-09 
01:47:13 UTC (rev 12380)
@@ -83,7 +83,7 @@
     return pdfDoc;
 }
 
-static NSURL *PDFURLForPDFBundleURL(NSURL *aURL)
+static NSURL *createPDFURLForPDFBundleURL(NSURL *aURL)
 {
     NSString *filePath = [aURL path];
     NSArray *files = [[NSFileManager defaultManager] subpathsAtPath:filePath];
@@ -99,7 +99,7 @@
     }
     if (pdfFile)
         pdfFile = [filePath stringByAppendingPathComponent:pdfFile];
-    return pdfFile ? [NSURL fileURLWithPath:pdfFile] : nil;
+    return pdfFile ? [[NSURL alloc] initFileURLWithPath:pdfFile] : nil;
 }
 
 // return the same thing as PDF; just a container for the URL, until actually 
asked to render the PS file
@@ -115,7 +115,10 @@
 - (id)initWithPDFDAtURL:(NSURL *)aURL;
 {
     if (self = [self initWithPDFAtURL:aURL]) {
-        if (PDFURLForPDFBundleURL(_fileURL)) {
+        NSURL *fileURL = createPDFURLForPDFBundleURL(_fileURL);
+        if (fileURL) {
+            [_fileURL release];
+            _fileURL = fileURL;
             _iconType = FVPDFDType;
         } else {
             NSZone *zone = [self zone];
@@ -302,12 +305,10 @@
     if (NULL == _pdfPage) {
         
         if (NULL == _pdfDoc) {
-            if (FVPDFType == _iconType)
+            if (FVPostscriptType == _iconType)
+                _pdfDoc = createCGPDFDocumentWithPostScriptURL(_fileURL);
+            else
                 _pdfDoc = CGPDFDocumentCreateWithURL((CFURLRef)_fileURL);
-            else if (FVPDFDType == _iconType)
-                _pdfDoc = 
CGPDFDocumentCreateWithURL((CFURLRef)PDFURLForPDFBundleURL(_fileURL));
-            else
-                _pdfDoc = createCGPDFDocumentWithPostScriptURL(_fileURL);
             
             _pageCount = CGPDFDocumentGetNumberOfPages(_pdfDoc);
         }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to