I do [_exportManager shouldCancelExport] inside exportManagerDidFinishExport if I find a potential problem writing out files from my plug-in.
However it does not have any effect and the result is that the task continues forever in Aperture's task list. I tried adding exportProgress.currentValue = exportProgress.totalValue but that makes no difference. If I add [_exportManager shouldFinishExport]; following [_exportManager shouldCancelExport] then it does work as expected.
shouldCancelExportThe plug-in can call this method at any time to have Aperture put away all export windows, stop the export process, and return the user to the workspace.
==========================================================================
Aperture 2.0
Summary:
shouldCancelExport has no effect if sent inside exportManagerDidEndExport.
Steps to Reproduce:
1. Install Random Wok or build it from source supplied (it copies to the Export plugins folder as part of the build).
2. Create an empty folder on the desktop
3. Start Aperture 2.0
4. Select three images
5. Export using Random Wok
6. Turn Freeze With flag ON. The other controls do not matter as long as they are not changed.
7. Export the images, selecting the empty folder on the desktop as the destination. This works. Notice that the export completes and then the files are renamed with random names
8. Repeat steps 4,5,6,7 This time the export succeeds, but the rename fails because the plug-in has detected that the files already exist. A dialog box is shown. Click STOP.
9. Aperture believes that the export continues and the spinner is present and the tasks list shows the export still in progress.
10. Quit Aperture
11. On line 475 of Random_Wok.m uncomment the line so that it reads [_exportManager shouldFinishExport];
The original looks like this:
[_exportManager shouldCancelExport];
[self lockProgress];
exportProgress.currentValue = exportProgress.totalValue;
[ exportProgress.message autorelease];
[self unlockProgress];
// [_exportManager shouldFinishExport];
return;
12. Build and run. Install the plug-in if needed (it copies to the Export plugins folder as part of the build).
13. Repeat step 8. The spinner disappears, as it should.
Expected Results:
The spinner should stop and Aperture knows that the task has completed.
Actual Results:
Spinner does not stop. Aperture thinks that the export is still continuing.
Regression:
Does not occur with any previous version of Aperture.
Notes:See also
Radar 5751020. Source is enclosed.