Skip to content

fix: 更新时不保存窗口位置#5819

Open
CiiLu wants to merge 4 commits intoHMCL-dev:mainfrom
CiiLu:updateeeeeeeeeeeeeeeeee
Open

fix: 更新时不保存窗口位置#5819
CiiLu wants to merge 4 commits intoHMCL-dev:mainfrom
CiiLu:updateeeeeeeeeeeeeeeeee

Conversation

@CiiLu
Copy link
Copy Markdown
Contributor

@CiiLu CiiLu commented Mar 21, 2026

No description provided.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java
@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 17, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the update process in UpdateHandler.java to ensure a clean application shutdown and data persistence before applying updates. It introduces logic to wait for Controllers.onApplicationStop() to execute on the JavaFX thread and calls FileSaver.waitForAllSaves() to prevent data loss. The review feedback correctly identifies a potential hang if onApplicationStop() throws an exception and suggests using a try-finally block to ensure the CompletableFuture always completes.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java
@Glavo
Copy link
Copy Markdown
Member

Glavo commented Apr 18, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 12e7e18455

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


Platform.runLater(() -> {
try {
Controllers.onApplicationStop();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Delay app-stop state changes until update launch succeeds

Calling Controllers.onApplicationStop() here mutates global UI shutdown state before requestUpdate(...) is attempted. If requestUpdate fails with IOException (for example, jar verification or ProcessBuilder.start() failure), the catch path shows an error and keeps the current process alive, but onApplicationStop() has already disabled window geometry tracking (Controllers.onApplicationStop nulls the stage tracking fields), so the rest of the session and final exit can no longer persist window position/size.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants