Revision: 9413
          http://sourceforge.net/p/skim-app/code/9413
Author:   hofman
Date:     2017-04-29 17:22:09 +0000 (Sat, 29 Apr 2017)
Log Message:
-----------
make current active annotation thread safe

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

Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m  2017-04-28 09:00:24 UTC (rev 9412)
+++ trunk/PDFAnnotation_SKExtensions.m  2017-04-29 17:22:09 UTC (rev 9413)
@@ -89,13 +89,19 @@
 static PDFAnnotation *currentActiveAnnotation = nil;
 
 + (PDFAnnotation *)currentActiveAnnotation {
-    return currentActiveAnnotation;
+    PDFAnnotation *annotation = nil;
+    @synchronized (self) {
+        annotation = [currentActiveAnnotation retain];
+    }
+    return [annotation autorelease];
 }
 
 + (void)setCurrentActiveAnnotation:(PDFAnnotation *)annotation {
-    if (currentActiveAnnotation != annotation) {
-        [currentActiveAnnotation release];
-        currentActiveAnnotation = [annotation retain];
+    @synchronized (self) {
+        if (currentActiveAnnotation != annotation) {
+            [currentActiveAnnotation release];
+            currentActiveAnnotation = [annotation retain];
+        }
     }
 }
 

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to