Revision: 14171
          http://sourceforge.net/p/skim-app/code/14171
Author:   hofman
Date:     2024-04-03 15:56:17 +0000 (Wed, 03 Apr 2024)
Log Message:
-----------
create queue in init

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

Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m   2024-04-03 15:00:44 UTC (rev 14170)
+++ trunk/SKPDFSynchronizer.m   2024-04-03 15:56:17 UTC (rev 14171)
@@ -100,7 +100,7 @@
 - (instancetype)init {
     self = [super init];
     if (self) {
-        queue = NULL;
+        queue = 
dispatch_queue_create("net.sourceforge.skim-app.queue.SKPDFSynchronizer", NULL);
         
         lock = [[NSLock alloc] init];
         
@@ -210,7 +210,7 @@
     return [file 
stringByAppendingPathExtension:[SKPDFSynchronizerTexExtensions firstObject]];
 }
 
-#pragma mark PDFSync
+#pragma mark Loading sync file
 
 static inline SKPDFSyncRecord *recordForIndex(NSMapTable *records, NSInteger 
recordIndex) {
     SKPDFSyncRecord *record = (__bridge SKPDFSyncRecord *)NSMapGet(records, 
(void *)recordIndex);
@@ -329,8 +329,6 @@
     return rv;
 }
 
-#pragma mark SyncTeX
-
 - (BOOL)loadSynctexFile:(NSString *)theFileName {
     BOOL rv = NO;
     synctex = [[SKSyncTeX alloc] initWithFileName:theFileName];
@@ -349,8 +347,6 @@
     return rv;
 }
 
-#pragma mark Generic
-
 - (BOOL)loadSyncFileIfNeeded {
     NSString *theFileName = [self fileName];
     BOOL rv = NO;
@@ -383,18 +379,10 @@
     return rv;
 }
 
-#pragma mark Queue
-
-- (dispatch_queue_t)queue {
-    if (queue == NULL)
-        queue = 
dispatch_queue_create("net.sourceforge.skim-app.queue.SKPDFSynchronizer", NULL);
-    return queue;
-}
-
 #pragma mark Finding API
 
 - (void)findFileAndLineForLocation:(NSPoint)point inRect:(NSRect)rect 
pageBounds:(NSRect)bounds atPageIndex:(NSUInteger)pageIndex {
-    dispatch_async([self queue], ^{
+    dispatch_async(queue, ^{
         if ([self shouldKeepRunning] && [self loadSyncFileIfNeeded]) {
             NSInteger foundLine = 0;
             NSString *foundFile = nil;
@@ -420,7 +408,7 @@
 - (void)findPageAndLocationForLine:(NSInteger)line inFile:(NSString *)file 
options:(SKPDFSynchronizerOption)options {
     if (file == nil)
         file = [self defaultSourceFile];
-    dispatch_async([self queue], ^{
+    dispatch_async(queue, ^{
         if (file && [self shouldKeepRunning] && [self loadSyncFileIfNeeded]) {
             NSUInteger foundPageIndex = NSNotFound;
             NSPoint foundPoint = NSZeroPoint;

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