Skip to content

fix: 在任务取消后保留向导 - #6993

Open
KSSJW wants to merge 1 commit into
HMCL-dev:mainfrom
KSSJW:fix/task-executor-dialog-wizard-cancellation-exception
Open

KSSJW wants to merge 1 commit into
HMCL-dev:mainfrom
KSSJW:fix/task-executor-dialog-wizard-cancellation-exception

Conversation

@KSSJW

@KSSJW KSSJW commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

不止 ModpackFileSelectionPage,InstallersPage 也会在任务取消后退出向导,这会丢失用户选择或填写的内容。

涉及 issue

测试情况

  • 任务取消后保留向导
  • 取消后不影响当前向导再次执行任务
  • 任务完成后结束向导

@github-actions github-actions Bot added the 1+ label Oct 17, 2026
@KSSJW
KSSJW force-pushed the fix/task-executor-dialog-wizard-cancellation-exception branch from 4577262 to 9355a8f Compare October 17, 2026 03:02

@KSSJW KSSJW left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

@KSSJW
KSSJW marked this pull request as ready for review October 17, 2026 03:13
@fishdry1000

Copy link
Copy Markdown
Contributor

这样修改只是修改表面,正在执行的压缩逻辑并不会因为关闭窗口而停止()

可能会导致多个任务同时操作一个文件导致损坏qwq

@Glavo Glavo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本审查建议由 GPT-6 Astra 生成


已将具体审查建议标注在对应代码行。

Comment on lines 54 to 55
it.fireEvent(new DialogCloseEvent());
onEnd();
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 等待旧任务停止后再允许重试

导出向导没有设置 TaskCleanup,因此取消时仍会立即关闭对话框。删除 onEnd() 后,用户可以直接再次导出到同一路径,但 AsyncTaskExecutor.cancel() 仅设置标志,正在执行的 Zipper 压缩不会立即停止。两个任务可能同时写入文件,而且旧的 MCBBS/服务器整合包导出任务在最终检测到取消后,会通过失败回调删除该路径,连新任务成功生成的文件也一起删除。应对所有任务保持模态或禁用重试,直到 onStop 完成后再恢复向导操作。

Iu-yang1 added a commit to Iu-yang1/HMCL-Fix that referenced this pull request Oct 20, 2026
Iu-yang1 added a commit to Iu-yang1/HMCL-Fix that referenced this pull request Oct 20, 2026
Batch integration of upstream HMCL PRs HMCL-dev#7023 HMCL-dev#6993 HMCL-dev#6946 HMCL-dev#7019 HMCL-dev#7004 HMCL-dev#6986 HMCL-dev#6858 HMCL-dev#6994 HMCL-dev#6864 HMCL-dev#6519 HMCL-dev#4962.

Java CI and Check Codes passed; JAR integrity, feature classes, and preserved OAuth/CurseForge configuration independently verified. Fork release and disabled upstream auto-update policy preserved.

@Glavo Glavo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本审查建议由 GPT-6 Astra 生成

Comment on lines 54 to 55
it.fireEvent(new DialogCloseEvent());
onEnd();
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 等待旧任务停止后再允许在保留的向导中重试

导出较大的整合包时,点击取消会立即关闭对话框,但 AsyncTaskExecutor.cancel() 只设置取消标志,正在执行的压缩仍会继续。保留向导后,用户可以立即再次点击“下一步”,让两个导出任务写入同一路径;旧的 McbbsModpackExportTask 随后还会在失败回调中删除该路径,导致新导出文件损坏或消失。应等到旧任务的 onStop 和清理完成后,才恢复向导操作。

Comment on lines 95 to 96
if (completedFailure instanceof CancellationException) {
onEnd();
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 保留向导时同步保留在线 Java 安装的下载包

通过在线下载进入 JavaInstallPage,在解压过程中取消安装后,此分支现在会保留页面,但 JavaInstallPage.finish() 注册的 whenComplete 回调仍会删除下载的临时安装包,该回调在取消时也会执行。因此,即使等待任务完全停止,再次点击安装仍会引用已删除的文件并失败。需要同步调整下载包的清理时机,在向导允许重试期间保留它,或在重试时重新下载。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants