-
Notifications
You must be signed in to change notification settings - Fork 869
Description
There is a race condition in the export process (main/export.ts) where an export operation can be marked as completed even if the user has explicitly canceled it.
This occurs if the underlying export action (e.g., the ffmpeg process or plugin action) completes successfully shortly after the cancellation request is made, but before the cancellation logic has been checked in the finalization step of the _start method.
Steps to Reproduce
Start an export process (e.g., to MP4).
Cancel the export immediately or just as it is about to finish.
(In a race condition scenario) The underlying action resolves successfully.
The _start method resumes and sets this.status = ExportStatus.completed.
Expected Behavior
If an export is canceled, the final status should always be ExportStatus.canceled, regardless of whether the underlying process finished successfully or not. The UI should reflect the cancellation.
Actual Behavior
The status incorrectly updates to completed, causing the UI to show "Export completed" for a canceled job.
Impact
Users may be confused by the "Export completed" message for a job they intended to cancel. It may also trigger post-export actions (like notifications or file reveals) that should not happen for canceled jobs.
Technical Details
The issue lies in main/export.ts. The _start method awaits the
action
promise. If that promise resolves (even if cancellation happened elsewhere), the code proceeds to set status = completed without checking this.context.isCanceled.