Revision: 14045
          http://sourceforge.net/p/skim-app/code/14045
Author:   hofman
Date:     2024-02-14 15:31:47 +0000 (Wed, 14 Feb 2024)
Log Message:
-----------
use flag to determine whether we need to clanup the UI in dealloc, the window's 
delegate will always be nil in dealloc as it is weak

Modified Paths:
--------------
    trunk/SKMainWindowController.h
    trunk/SKMainWindowController.m

Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h      2024-02-13 14:58:24 UTC (rev 14044)
+++ trunk/SKMainWindowController.h      2024-02-14 15:31:47 UTC (rev 14045)
@@ -199,6 +199,7 @@
         unsigned int recentInfoNeedsUpdate:1;
         unsigned int hasCropped:1;
         unsigned int fullSizeContent:1;
+        unsigned int needsCleanup:1;
     } mwcFlags;
 }
 

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2024-02-13 14:58:24 UTC (rev 14044)
+++ trunk/SKMainWindowController.m      2024-02-14 15:31:47 UTC (rev 14045)
@@ -265,12 +265,13 @@
 }
 
 - (void)dealloc {
-    if ([self isWindowLoaded] && [[self window] delegate])
+    if ([self isWindowLoaded] && mwcFlags.needsCleanup == 1)
         SKENSURE_MAIN_THREAD( [self cleanup]; );
 }
 
 // this is called from windowWillClose:
 - (void)cleanup {
+    mwcFlags.needsCleanup = 0;
     if (activity) {
         [[NSProcessInfo processInfo] endActivity:activity];
         activity = nil;
@@ -292,7 +293,6 @@
     [[pdfView document] setDelegate:nil];
     [noteTypeSheetController setDelegate:nil];
     [[pdfView document] setContainingDocument:nil];
-    // we may retain our own document here
     [self setPresentationNotesDocument:nil];
 }
 
@@ -301,6 +301,8 @@
     BOOL hasWindowSetup = [savedNormalSetup count] > 0;
     NSWindow *window = [self window];
     
+    mwcFlags.needsCleanup = 0;
+    
     mwcFlags.settingUpWindow = 1;
     
     // Set up the panes and subviews, needs to be done before we resize them

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