Revision: 15541
          http://sourceforge.net/p/skim-app/code/15541
Author:   hofman
Date:     2025-06-24 14:44:50 +0000 (Tue, 24 Jun 2025)
Log Message:
-----------
consider three cases after for delayed termination

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

Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m     2025-06-24 14:24:42 UTC (rev 15540)
+++ trunk/SKApplicationController.m     2025-06-24 14:44:50 UTC (rev 15541)
@@ -299,17 +299,18 @@
 }
 
 - (void)applicationStartsTerminating:(NSNotification *)aNotification {
-    [currentDocumentsTimer invalidate];
-    currentDocumentsTimer = nil;
-    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
-    [nc removeObserver:self name:SKDocumentDidShowNotification object:nil];
-    [nc removeObserver:self 
name:SKDocumentControllerDidRemoveDocumentNotification object:nil];
-    [self registerCurrentDocuments:nil];
+    if (currentDocumentsTimer == nil) {
+        [currentDocumentsTimer invalidate];
+        currentDocumentsTimer = nil;
+        NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+        [nc removeObserver:self name:SKDocumentDidShowNotification object:nil];
+        [nc removeObserver:self 
name:SKDocumentControllerDidRemoveDocumentNotification object:nil];
+        [self registerCurrentDocuments:nil];
+    }
 }
 
 - (void)applicationDocumentControllerCanceledTerminate:(NSApplication 
*)application {
-    if (currentDocumentsTimer == nil)
-        [self registerForCurrentDocumentsNotifications];
+    [self registerForCurrentDocumentsNotifications];
 }
 
 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication 
*)application {
@@ -320,14 +321,14 @@
                 break;
             } else {
                 DISPATCH_MAIN_AFTER_SEC(0.51, ^{
-                    if ([doc interactionMode] == SKPresentationMode && [doc 
canExitPresentation] == NO) {
+                    if ([doc interactionMode] != SKPresentationMode) {
+                        [NSApp replyToApplicationShouldTerminate:YES];
+                    } else if ([doc canExitPresentation]) {
+                        [doc setInteractionMode:SKNormalMode];
+                        [NSApp replyToApplicationShouldTerminate:YES];
+                    } else {
                         [NSApp replyToApplicationShouldTerminate:NO];
-                        if (currentDocumentsTimer == nil)
-                            [self registerForCurrentDocumentsNotifications];
-                    } else {
-                        if ([doc canExitPresentation])
-                            [doc setInteractionMode:SKNormalMode];
-                        [NSApp replyToApplicationShouldTerminate:YES];
+                        [self registerForCurrentDocumentsNotifications];
                     }
                 });
                 return NSTerminateLater;

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



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to