Revision: 28682
          http://sourceforge.net/p/bibdesk/svn/28682
Author:   hofman
Date:     2024-01-26 15:25:41 +0000 (Fri, 26 Jan 2024)
Log Message:
-----------
Call didDismissSheet from completionHandler block, so we can be sure the object 
is still valid. This is not neccessarily the case at the end of the 
dismissSheet: method. Also retains self by the block, so no need for another 
variable.

Modified Paths:
--------------
    trunk/bibdesk/NSWindowController_BDSKExtensions.m

Modified: trunk/bibdesk/NSWindowController_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSWindowController_BDSKExtensions.m   2024-01-25 23:35:15 UTC 
(rev 28681)
+++ trunk/bibdesk/NSWindowController_BDSKExtensions.m   2024-01-26 15:25:41 UTC 
(rev 28682)
@@ -94,11 +94,10 @@
 #pragma mark Sheet methods
 
 - (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void 
(^)(NSInteger result))handler {
-    __block id strongSelf = self;
     [window beginSheet:[self window] completionHandler:^(NSModalResponse 
result){
         if (handler)
             handler(result);
-        strongSelf = nil;
+        [self didDismissSheet];
     }];
 }
 
@@ -106,10 +105,7 @@
 
 - (IBAction)dismiss:(id)sender {
     NSWindow *window = [[self window] sheetParent];
-    if (window) {
-        [window endSheet:[self window] returnCode:[sender tag]];
-        [self didDismissSheet];
-    }
+    [window endSheet:[self window] returnCode:[sender tag]];
 }
 
 @end

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



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to