Revision: 16755
http://sourceforge.net/p/skim-app/code/16755
Author: hofman
Date: 2026-10-30 22:29:18 +0000 (Fri, 30 Oct 2026)
Log Message:
-----------
cache fileURL of bookmark during the current run of the runloop to avoid
resolving the alias for multiple properties, e.g. for bindings in the UI
Modified Paths:
--------------
trunk/SKBookmark.m
Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m 2026-10-30 22:16:11 UTC (rev 16754)
+++ trunk/SKBookmark.m 2026-10-30 22:29:18 UTC (rev 16755)
@@ -70,6 +70,7 @@
@interface SKFileBookmark : SKBookmark {
SKAlias *alias;
+ NSURL *cachedFileURL;
NSString *label;
NSUInteger pageIndex;
NSDictionary *setup;
@@ -526,7 +527,18 @@
}
- (NSURL *)fileURL {
- return [alias fileURLNoUI];
+ if (cachedFileURL)
+ return [cachedFileURL isEqual:[NSNull null]] ? nil : cachedFileURL;
+ cachedFileURL = [alias fileURLNoUI] ?: (id)[NSNull null];
+ if (cachedFileURL) {
+ __weak typeof(self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ __strong typeof(weakSelf) strongSelf = weakSelf;
+ if (strongSelf)
+ strongSelf->cachedFileURL = nil;
+ });
+ }
+ return cachedFileURL;
}
- (void)setFileURL:(NSURL *)fileURL {
@@ -533,10 +545,13 @@
SKAlias *newAlias = [[SKAlias alloc] initWithURL:fileURL];
if (newAlias) {
alias = newAlias;
+ cachedFileURL = nil;
}
}
- (NSURL *)fileURLToOpen {
+ if (cachedFileURL && [cachedFileURL isEqual:[NSNull null]] == NO)
+ return cachedFileURL;
return [alias 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