Revision: 12278
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12278&view=rev
Author:   amaxwell
Date:     2008-01-05 10:47:29 -0800 (Sat, 05 Jan 2008)

Log Message:
-----------
Use trylock in the QL icon.

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

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVQLIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVQLIcon.m        2008-01-05 
18:46:34 UTC (rev 12277)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVQLIcon.m        2008-01-05 
18:47:29 UTC (rev 12278)
@@ -112,15 +112,16 @@
 - (BOOL)needsRenderForSize:(NSSize)size
 {
     BOOL needsRender = NO;
-    pthread_mutex_lock(&_mutex);
-    if (NO == _quickLookFailed) {
-        // The _fullSize is zero or whatever quicklook returned last time, 
which may be something odd like 78x46.  Since we ask QL for a size but it 
constrains the size it actually returns based on the icon's aspect ratio, we 
have to check height and width.  Just checking height in this was causing an 
endless loop asking for a size it won't return.
-        needsRender = (NULL == _imageRef || checkSizes(_fullSize, size));
+    if (pthread_mutex_trylock(&_mutex) == 0) {
+        if (NO == _quickLookFailed) {
+            // The _fullSize is zero or whatever quicklook returned last time, 
which may be something odd like 78x46.  Since we ask QL for a size but it 
constrains the size it actually returns based on the icon's aspect ratio, we 
have to check height and width.  Just checking height in this was causing an 
endless loop asking for a size it won't return.
+            needsRender = (NULL == _imageRef || checkSizes(_fullSize, size));
+        }
+        else {
+            needsRender = [_fallbackIcon needsRenderForSize:size];
+        }
+        _desiredSize = size;
     }
-    else {
-        needsRender = [_fallbackIcon needsRenderForSize:size];
-    }
-    _desiredSize = size;
     pthread_mutex_unlock(&_mutex);
     return needsRender;
 }


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to