Revision: 25432
          http://sourceforge.net/p/bibdesk/svn/25432
Author:   hofman
Date:     2021-01-18 15:10:30 +0000 (Mon, 18 Jan 2021)
Log Message:
-----------
unlock when we are done with internal ivars

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

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageIcon.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageIcon.m     2021-01-18 
07:30:32 UTC (rev 25431)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVImageIcon.m     2021-01-18 
15:10:30 UTC (rev 25432)
@@ -308,8 +308,7 @@
 - (void)drawInRect:(NSRect)dstRect ofContext:(CGContextRef)context;
 {
     // locking immediately blocks the main thread if we have a huge image 
that's loading via ImageIO
-    BOOL didLock = ([self tryLock]);
-    if (didLock) {
+    if ([self tryLock]) {
         
         if (NULL != _thumbnail || NULL != _fullImage) {
             CGRect drawRect = [self _drawingRectWithRect:dstRect];
@@ -322,27 +321,34 @@
                 image = _thumbnail;
             
             CGContextDrawImage(context, drawRect, image);
-        } 
+            [self unlock];
+            if (_drawsLinkBadge) {
+                // get rid of any shadow, or we may draw a text shadow if the 
page is transparent
+                CGContextSaveGState(context);
+                CGContextSetShadowWithColor(context, CGSizeZero, 0, NULL);
+                [self _badgeIconInRect:dstRect ofContext:context];
+                CGContextSaveGState(context);
+            }
+        }
         else if (_loadFailed && nil != [self _fallbackIcon]) {
+            [self unlock];
             [_fallbackIcon drawInRect:dstRect ofContext:context];
+            if (_drawsLinkBadge) {
+                // get rid of any shadow, or we may draw a text shadow if the 
page is transparent
+                CGContextSaveGState(context);
+                CGContextSetShadowWithColor(context, CGSizeZero, 0, NULL);
+                [self _badgeIconInRect:dstRect ofContext:context];
+                CGContextSaveGState(context);
+            }
         }
         else {
+            [self unlock];
             [self _drawPlaceholderInRect:dstRect ofContext:context];
         }
-        
-        if (_drawsLinkBadge) {
-            // get rid of any shadow, or we may draw a text shadow if the page 
is transparent
-            CGContextSaveGState(context);
-            CGContextSetShadowWithColor(context, CGSizeZero, 0, NULL);
-            [self _badgeIconInRect:dstRect ofContext:context];
-            CGContextSaveGState(context);
-        }
-        
     }
     else {
         [self _drawPlaceholderInRect:dstRect ofContext:context];
     }
-    if (didLock) [self unlock];
 }
 
 @end

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



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to