Revision: 29629
          http://sourceforge.net/p/bibdesk/svn/29629
Author:   hofman
Date:     2025-09-26 15:45:24 +0000 (Fri, 26 Sep 2025)
Log Message:
-----------
don't use open panl sheet for BDSKDownload, because th downloaded file can be 
removed when the delegate method ends.

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

Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m    2025-09-26 09:29:02 UTC (rev 
29628)
+++ trunk/bibdesk/BDSKTextImportController.m    2025-09-26 15:45:24 UTC (rev 
29629)
@@ -1255,15 +1255,14 @@
     [sPanel setCanSelectHiddenExtension:YES];
     [sPanel setNameFieldStringValue:destinationName];
     
-    [sPanel beginSheetModalForWindow:[self window] 
completionHandler:^(NSModalResponse result){
-        NSURL *fileURL = nil;
-        if (result == NSModalResponseOK) {
-            fileURL = [sPanel URL];
-            if ([fileURL checkResourceIsReachableAndReturnError:NULL])
-                [[NSFileManager defaultManager] removeItemAtURL:fileURL 
error:nil];
-        }
-        completionHandler(fileURL);
-    }];
+    // we need to do this modally, not using a sheet, as the download may 
otherwise delete the downloaded file before the sheet is done
+    NSURL *fileURL = nil;
+    if ([sPanel runModal] == NSModalResponseOK) {
+        fileURL = [sPanel URL];
+        if ([fileURL checkResourceIsReachableAndReturnError:NULL])
+            [[NSFileManager defaultManager] removeItemAtURL:fileURL error:nil];
+    }
+    completionHandler(fileURL);
 }
 
 - (void)download:(BDSKDownload *)aDownload didCreateDestination:(NSURL 
*)destinationURL {

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