Revision: 15531
          http://sourceforge.net/p/skim-app/code/15531
Author:   hofman
Date:     2025-06-23 16:21:27 +0000 (Mon, 23 Jun 2025)
Log Message:
-----------
forwward windowWillClose from window controller to document

Modified Paths:
--------------
    trunk/SKMainDocument.m
    trunk/SKMainWindowController_UI.m

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2025-06-23 16:04:00 UTC (rev 15530)
+++ trunk/SKMainDocument.m      2025-06-23 16:21:27 UTC (rev 15531)
@@ -151,8 +151,6 @@
 
 - (void)tryToUnlockDocument:(PDFDocument *)document;
 
-- (void)handleWindowWillCloseNotification:(NSNotification *)notification;
-
 @end
 
 #pragma mark -
@@ -210,6 +208,7 @@
     tmpData = nil;
 }
 
+// this is called by the window controller even though we are not te owner
 - (void)windowControllerDidLoadNib:(NSWindowController *)aController{
     [self setDataFromTmpData];
     
@@ -216,9 +215,6 @@
     fileUpdateChecker = [[SKFileUpdateChecker alloc] initForDocument:self];
     // the file update checker starts disabled, setting enabled will start 
checking if it should
     [fileUpdateChecker setEnabled:YES];
-    
-       [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handleWindowWillCloseNotification:) 
-                                                 
name:NSWindowWillCloseNotification object:[[self mainWindowController] window]];
 }
 
 - (void)showWindows{
@@ -1438,14 +1434,14 @@
 
 #pragma mark Notification handlers
 
-- (void)handleWindowWillCloseNotification:(NSNotification *)notification {
-    NSWindow *window = [notification object];
-    // ignore when we're switching fullscreen/main windows
-    if ([window isEqual:[[window windowController] window]]) {
-        [fileUpdateChecker terminate];
-        fileUpdateChecker = nil;
-        [synchronizer terminate];
-    }
+// this is forwarded by the window controller
+- (void)windowWillClose:(NSNotification *)notification {
+    [self saveRecentDocumentInfo];
+    
+    [fileUpdateChecker terminate];
+    fileUpdateChecker = nil;
+    
+    [synchronizer terminate];
 }
 
 #pragma mark Pdfsync support

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2025-06-23 16:04:00 UTC (rev 15530)
+++ trunk/SKMainWindowController_UI.m   2025-06-23 16:21:27 UTC (rev 15531)
@@ -257,7 +257,7 @@
 
 - (void)windowWillClose:(NSNotification *)notification {
     if ([[notification object] isEqual:[self window]]) {
-        [[self document] saveRecentDocumentInfo];
+        [(id)[self document] windowWillClose:notification];
         if ([[pdfView document] isFinding])
             [[pdfView document] cancelFindString];
         if ((mwcFlags.isEditingTable || [pdfView isEditing]) && [self 
commitEditing] == NO)

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