fix: Add delay before application exit to ensure config is saved#679
Merged
lzwind merged 1 commit intolinuxdeepin:masterfrom Sep 17, 2025
Merged
fix: Add delay before application exit to ensure config is saved#679lzwind merged 1 commit intolinuxdeepin:masterfrom
lzwind merged 1 commit intolinuxdeepin:masterfrom
Conversation
Implement a delay of 1000ms before quitting the application to allow asynchronous configuration saving to complete. This change enhances the reliability of the application exit process. Log: Add delay before application exit to ensure config is saved. Bug: https://pms.uniontech.com/bug-view-333889.html
Reviewer's guide (collapsed on small PRs)Reviewer's GuideImplemented a 1000ms exit delay using QTimer to ensure asynchronous config saving completes before quitting, replacing the direct quit call and updating related logging and window handling. Sequence diagram for delayed application exit after config savesequenceDiagram
participant User
participant MainWindow
participant CooperationUtil
participant QTimer
participant QApplication
User->>MainWindow: Initiate close dialog
MainWindow->>User: Show close dialog
User->>MainWindow: Accept dialog
MainWindow->>CooperationUtil: saveOption(isExit)
Note right of CooperationUtil: Asynchronous config save
MainWindow->>QTimer: singleShot(1000ms, quit)
QTimer->>QApplication: quit()
MainWindow->>MainWindow: hide()
Class diagram for updated MainWindow exit logicclassDiagram
class MainWindow {
+showCloseDialog()
-int delay
}
class CooperationUtil {
+saveOption(isExit)
}
MainWindow --> CooperationUtil : uses
MainWindow --> QTimer : uses
MainWindow --> QApplication : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review这段代码的审查意见如下:
// 建议将延迟时间定义为常量
static const int CONFIG_WRITE_DELAY_MS = 1000;
// 建议将lambda表达式提取为单独的函数
void MainWindow::performExit() {
QApplication::quit();
}
// 在showCloseDialog中使用
if (isExit) {
DLOG << "Exiting application with delay:" << delay;
QTimer::singleShot(delay, this, &MainWindow::performExit);
}
总体来说,这段代码实现了一个合理的功能,但可以通过一些改进来提高可维护性和可读性。 |
lzwind
approved these changes
Sep 17, 2025
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, re2zero The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement a delay of 1000ms before quitting the application to allow asynchronous configuration saving to complete. This change enhances the reliability of the application exit process.
Log: Add delay before application exit to ensure config is saved.
Bug: https://pms.uniontech.com/bug-view-333889.html
Summary by Sourcery
Delay application exit by 1000ms when saving configuration to ensure the async write completes before quitting.
Bug Fixes:
Enhancements: