Revision: 14338
          http://sourceforge.net/p/skim-app/code/14338
Author:   hofman
Date:     2024-06-13 09:41:35 +0000 (Thu, 13 Jun 2024)
Log Message:
-----------
fall back to superview to get pdfview if getting the ivar fails

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

Modified: trunk/PDFDocumentView_SKExtensions.m
===================================================================
--- trunk/PDFDocumentView_SKExtensions.m        2024-06-12 16:29:38 UTC (rev 
14337)
+++ trunk/PDFDocumentView_SKExtensions.m        2024-06-13 09:41:35 UTC (rev 
14338)
@@ -53,20 +53,22 @@
 
 #pragma mark -
 
-static NSString *pdfViewIvarKeyPath = @"_private.pdfView";
+static id fallback_getPDFView(id self, SEL _cmd) {
+    id pdfView = [[self enclosingScrollView] superview];
+    return [pdfView isKindOfClass:[PDFView class]] ? pdfView : nil;
+}
 
 static id fallback_ivar_getPDFView(id self, SEL _cmd) {
     id pdfView = nil;
-    @try { pdfView = [self valueForKeyPath:pdfViewIvarKeyPath]; }
-    @catch (id exception) {}
+    @try {
+        pdfView = [self valueForKeyPath:@"_private.pdfView"];
+    }
+    @catch (id exception) {
+        pdfView = fallback_getPDFView(self, _cmd);
+    }
     return pdfView;
 }
 
-static id fallback_getPDFView(id self, SEL _cmd) {
-    id pdfView = [[self enclosingScrollView] superview];
-    return [pdfView isKindOfClass:[PDFView class]] ? pdfView : nil;
-}
-
 static id (*original_menuForEvent)(id, SEL, id) = NULL;
 
 static void (*original_updateTrackingAreas)(id, SEL) = NULL;

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