Revision: 28733
          http://sourceforge.net/p/bibdesk/svn/28733
Author:   hofman
Date:     2024-02-12 15:46:53 +0000 (Mon, 12 Feb 2024)
Log Message:
-----------
make view in icon operation weak to avoid retain cycle

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconOperation.h
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconOperation.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconOperation.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconOperation.h 2024-02-12 
15:36:06 UTC (rev 28732)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconOperation.h 2024-02-12 
15:46:53 UTC (rev 28733)
@@ -45,7 +45,7 @@
 {
 @protected;
     FVIcon   *_icon;
-    FVFileView *_view;
+    __weak FVFileView *_view;
 }
 
 // designated initializer; uses @selector(iconUpdated:) as callback (sent to 
view with icon as argument)

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconOperation.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconOperation.m 2024-02-12 
15:36:06 UTC (rev 28732)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVIconOperation.m 2024-02-12 
15:46:53 UTC (rev 28733)
@@ -65,15 +65,6 @@
 // returns an address-based hash, suitable for pointer equality
 - (NSUInteger)hash { return [_icon hash]; }
 
-- (void)dealloc
-{
-    // release is thread safe, but we don't want to trigger dealloc on this 
thread
-    NS_VALID_UNTIL_END_OF_SCOPE __block id view = _view;
-    dispatch_async(dispatch_get_main_queue(), ^{
-        view = nil;
-    });
-}
-
 @end
 
 
@@ -130,8 +121,10 @@
     if (NO == [self isCancelled]) {
         @autoreleasepool {
             [_icon renderForSize:_desiredSize];
-            FVIconUpdateOperation *op = [[FVIconUpdateOperation alloc] 
initWithIcon:_icon view:_view];
-            [[FVOperationQueue mainQueue] addOperation:op];
+            if (_view) {
+                FVIconUpdateOperation *op = [[FVIconUpdateOperation alloc] 
initWithIcon:_icon view:_view];
+                [[FVOperationQueue mainQueue] addOperation:op];
+            }
             [self finished];
         }
     }

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