Revision: 16758
          http://sourceforge.net/p/skim-app/code/16758
Author:   hofman
Date:     2026-10-31 15:43:24 +0000 (Sat, 31 Oct 2026)
Log Message:
-----------
clear cached file url with method to avoid needing strong variable

Modified Paths:
--------------
    trunk/SKBookmark.m

Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m  2026-10-31 15:04:09 UTC (rev 16757)
+++ trunk/SKBookmark.m  2026-10-31 15:43:24 UTC (rev 16758)
@@ -526,6 +526,10 @@
     return SKBookmarkTypeBookmark;
 }
 
+- (void)clearCachedFileURL {
+    cachedFileURL = nil;
+}
+
 - (NSURL *)fileURL {
     NSURL *fileURL = nil;
     if (cachedFileURL == nil) {
@@ -532,11 +536,7 @@
         fileURL = [alias fileURLNoUI];
         cachedFileURL = fileURL ?: (id)[NSNull null];
         __weak typeof(self) weakSelf = self;
-        dispatch_async(dispatch_get_main_queue(), ^{
-            __strong typeof(self) strongSelf = weakSelf;
-            if (strongSelf)
-                strongSelf->cachedFileURL = nil;
-        });
+        dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf 
clearCachedFileURL]; });
     } else if ([cachedFileURL isEqual:[NSNull null]] == NO) {
         fileURL = cachedFileURL;
     }
@@ -558,17 +558,12 @@
     } else {
         fileURL = [alias fileURL];
         if (cachedFileURL == nil) {
+            cachedFileURL = fileURL ?: (id)[NSNull null];
             __weak typeof(self) weakSelf = self;
-            dispatch_async(dispatch_get_main_queue(), ^{
-                __strong typeof(self) strongSelf = weakSelf;
-                if (strongSelf)
-                    strongSelf->cachedFileURL = nil;
-            });
+            dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf 
clearCachedFileURL]; });
+        } else if (fileURL) {
+            cachedFileURL = fileURL;
         }
-        if (fileURL)
-            cachedFileURL = fileURL;
-        else if (cachedFileURL == nil)
-            cachedFileURL = (id)[NSNull null];
     }
     return fileURL;
 }

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to