File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,9 @@ - (void)_toggleExportButtonWithBool:(NSNumber *)enable;
72
72
- (void )_resizeWindowForCustomFilenameViewByHeightDelta : (NSInteger )delta ;
73
73
- (void )_resizeWindowForAdvancedOptionsViewByHeightDelta : (NSInteger )delta ;
74
74
75
+ - (void )_waitUntilQueueIsEmpty : (id )sender ;
76
+ - (void )_queueIsEmpty : (id )sender ;
77
+
75
78
@end
76
79
77
80
@implementation SPExportController
@@ -364,8 +367,20 @@ - (IBAction)cancelExport:(id)sender
364
367
[sender setEnabled: NO ];
365
368
366
369
// Cancel all of the currently running operations
367
- [operationQueue cancelAllOperations ];
368
-
370
+ [operationQueue cancelAllOperations ]; // async call
371
+ [NSThread detachNewThreadWithName: SPCtxt (@" SPExportController cancelExport: waiting for empty queue" , tableDocumentInstance) target: self selector: @selector (_waitUntilQueueIsEmpty: ) object: sender];
372
+ }
373
+
374
+ - (void )_waitUntilQueueIsEmpty : (id )sender
375
+ {
376
+ [sender retain ];
377
+ [operationQueue waitUntilAllOperationsAreFinished ];
378
+ [self performSelectorOnMainThread: @selector (_queueIsEmpty: ) withObject: sender waitUntilDone: NO ];
379
+ [sender release ];
380
+ }
381
+
382
+ - (void )_queueIsEmpty : (id )sender
383
+ {
369
384
// Loop the cached export file paths and remove them from disk if they exist
370
385
for (SPExportFile *file in exportFiles)
371
386
{
You can’t perform that action at this time.
0 commit comments