fix: Delay archive loading in Wayland to fix dialog positioning#385
Merged
max-lvs merged 3 commits intolinuxdeepin:release/eaglefrom Apr 14, 2026
Merged
fix: Delay archive loading in Wayland to fix dialog positioning#385max-lvs merged 3 commits intolinuxdeepin:release/eaglefrom
max-lvs merged 3 commits intolinuxdeepin:release/eaglefrom
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideDelays the initial archive loading on Wayland by 200ms using a one‑time guard and QTimer to ensure password dialogs appear in the correct position instead of at (0,0). Sequence diagram for delayed archive loading on WaylandsequenceDiagram
actor User
participant MainWindow
participant UiTools
participant QTimer
participant PasswordDialog
alt Wayland_and_first_load
User->>MainWindow: handleArguments_Open(listParam)
MainWindow->>UiTools: isWayland()
UiTools-->>MainWindow: true
MainWindow->>QTimer: singleShot(200, callback)
QTimer-->>MainWindow: timeout
MainWindow->>MainWindow: loadArchive(listParam_0)
MainWindow->>PasswordDialog: showPasswordDialog()
PasswordDialog-->>User: Display_at_correct_position
else Not_Wayland_or_not_first_load
User->>MainWindow: handleArguments_Open(listParam)
MainWindow->>UiTools: isWayland()
UiTools-->>MainWindow: false_or_firstLoad_false
MainWindow->>MainWindow: loadArchive(listParam_0)
MainWindow->>PasswordDialog: showPasswordDialog()
PasswordDialog-->>User: Display_immediately
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The lambda passed to QTimer::singleShot captures listParam by reference, which can dangle after handleArguments_Open returns; capture the required value by copy instead (e.g., [this, file = listParam[0]]).
- Using a function-static firstLoad flag may be surprising and is not thread-safe; consider making this a member variable or a more explicit startup-state mechanism tied to the window instance.
- The 200ms delay is a magic number; consider defining a named constant or deriving the timing from an appropriate signal/event to make the intent clearer and behavior more robust across environments.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The lambda passed to QTimer::singleShot captures listParam by reference, which can dangle after handleArguments_Open returns; capture the required value by copy instead (e.g., [this, file = listParam[0]]).
- Using a function-static firstLoad flag may be surprising and is not thread-safe; consider making this a member variable or a more explicit startup-state mechanism tied to the window instance.
- The 200ms delay is a magic number; consider defining a named constant or deriving the timing from an appropriate signal/event to make the intent clearer and behavior more robust across environments.
## Individual Comments
### Comment 1
<location path="src/source/mainwindow.cpp" line_range="2598-2595" />
<code_context>
+ static bool firstLoad = true;
+ if (UiTools::isWayland() && firstLoad) {
+ firstLoad = false;
+ QTimer::singleShot(200, [this, &listParam]() {
+ loadArchive(listParam[0]);
+ });
+ } else {
</code_context>
<issue_to_address>
**issue (bug_risk):** Capturing `listParam` by reference in the delayed lambda risks a dangling reference.
Because the lambda runs 200 ms after `handleArguments_Open` returns, the const reference parameter `listParam` is already out of scope when accessed, leading to undefined behavior. Capture it safely instead, e.g. by value (`[this, listParam]`) or, more efficiently, capture just `listParam[0]` (`[this, path = listParam[0]]`) and use `path` inside the lambda.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
max-lvs
previously approved these changes
Apr 14, 2026
Delay first archive loading by 200ms in Wayland to allow window positioning to complete before showing password dialogs. Prevents dialogs from appearing at (0,0) when opening encrypted archives. Log: fix bug Bug: https://pms.uniontech.com/bug-view-355681.html
…cript" This reverts commit 4310822.
Display tar filename in progress when compressing tar.7z archives, improving user experience by showing meaningful progress information. 压缩tar.7z时显示tar文件名,提升用户体验。 Log: tar.7z压缩时提示tar文件名 PMS: BUG-356753 Influence: 压缩tar.7z格式时,进度提示显示tar文件名,用户可以看到正在处理的归档文件名称
fcc7bc8 to
fd8b3c5
Compare
max-lvs
approved these changes
Apr 14, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LiHua000, max-lvs 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 |
Contributor
Author
|
/merge |
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.
Delay first archive loading by 200ms in Wayland to allow window positioning to complete before showing password dialogs. Prevents dialogs from appearing at (0,0) when opening encrypted archives.
Log: fix bug
Bug: https://pms.uniontech.com/bug-view-355681.html
Summary by Sourcery
Bug Fixes: