Revision: 15981
          http://sourceforge.net/p/skim-app/code/15981
Author:   hofman
Date:     2026-01-08 17:01:36 +0000 (Thu, 08 Jan 2026)
Log Message:
-----------
make sure selection page and rect are chnaged thread safe

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2026-01-08 15:58:08 UTC (rev 15980)
+++ trunk/SKPDFView.m   2026-01-08 17:01:36 UTC (rev 15981)
@@ -4347,14 +4347,18 @@
     }
     
     CGFloat margin = HANDLE_SIZE / [self scaleFactor];
+    NSUInteger pageIndex = [page pageIndex];
     
-    if (selectionPageIndex != NSNotFound && [page pageIndex] != 
selectionPageIndex) {
-        [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin, 
-margin) ofPage:[self selectToolPage]];
-        [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin, 
-margin) ofPage:page];
+    if (pageIndex != selectionPageIndex) {
+        if (selectionPageIndex != NSNotFound) {
+            [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin, 
-margin) ofPage:[self selectToolPage]];
+            [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin, 
-margin) ofPage:page];
+        }
+        @synchronized (self) {
+            selectionPageIndex = pageIndex;
+        }
     }
     
-    selectionPageIndex = [page pageIndex];
-    
     BOOL didSelect = (NO == NSIsEmptyRect(selectionRect));
     
     SKRectEdges resizeHandle = didSelect ? 
SKResizeHandleForPointFromRect(initialPoint, selectionRect, margin) : 
SKRectEdgesNone;
@@ -4362,8 +4366,10 @@
     initialPoint = SKIntegralPoint(initialPoint);
     
     if (resizeHandle == SKRectEdgesNone && (didSelect == NO || 
NSPointInRect(initialPoint, selectionRect) == NO)) {
-        selectionRect.origin = initialPoint;
-        selectionRect.size = NSZeroSize;
+        @synchronized (self) {
+            selectionRect.origin = initialPoint;
+            selectionRect.size = NSZeroSize;
+        }
         resizeHandle = SKRectEdgesMaxX | SKRectEdgesMinY;
         if (didSelect)
             [self setNeedsDisplay:YES];

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