Revision: 15982
          http://sourceforge.net/p/skim-app/code/15982
Author:   hofman
Date:     2026-01-08 17:15:39 +0000 (Thu, 08 Jan 2026)
Log Message:
-----------
set selectionRect and selectionPageIndex in same synchronized block

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2026-01-08 17:01:36 UTC (rev 15981)
+++ trunk/SKPDFView.m   2026-01-08 17:15:39 UTC (rev 15982)
@@ -4348,19 +4348,7 @@
     
     CGFloat margin = HANDLE_SIZE / [self scaleFactor];
     NSUInteger pageIndex = [page pageIndex];
-    
-    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;
-        }
-    }
-    
-    BOOL didSelect = (NO == NSIsEmptyRect(selectionRect));
-    
+    BOOL didSelect = selectionPageIndex != NSNotFound;
     SKRectEdges resizeHandle = didSelect ? 
SKResizeHandleForPointFromRect(initialPoint, selectionRect, margin) : 
SKRectEdgesNone;
     
     initialPoint = SKIntegralPoint(initialPoint);
@@ -4369,10 +4357,19 @@
         @synchronized (self) {
             selectionRect.origin = initialPoint;
             selectionRect.size = NSZeroSize;
+            selectionPageIndex = pageIndex;
         }
         resizeHandle = SKRectEdgesMaxX | SKRectEdgesMinY;
         if (didSelect)
             [self setNeedsDisplay:YES];
+    } else if (pageIndex != selectionPageIndex) {
+        if (didSelect) {
+            [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin, 
-margin) ofPage:[self selectToolPage]];
+            [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin, 
-margin) ofPage:page];
+        }
+        @synchronized (self) {
+            selectionPageIndex = pageIndex;
+        }
     }
     
        NSRect initialRect = selectionRect;

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