Repository navigation
Conversation
1. When focus tab file is deleted or moved, recoverFile skips it 2. Remaining pending tab at index 0 is never loaded 3. activeTab(0) setCurrentIndex(0) does not trigger currentChanged 4. Add explicit loadPendingTab call before activeTab(0) in fallback Log: Fix editor unable to edit after restart when focus file deleted Influence: 1. Test opening 2 files, delete one, restart editor, verify editable 2. Test opening 3 files, delete focus file, restart, verify all editable 3. Test normal restart with existing files still works correctly fix: 焦点文件缺失时加载待加载标签页 1. 焦点标签页文件被删除或移动时,recoverFile 跳过该文件 2. 剩余待加载标签页位于索引0,永远不会被加载 3. activeTab(0) 的 setCurrentIndex(0) 不会触发 currentChanged 信号 4. 在兜底分支的 activeTab(0) 前增加显式 loadPendingTab 调用 Log: 修复焦点文件被删除后重启编辑器无法编辑的问题 Influence: 1. 测试打开2个文件,删除其中一个,重启编辑器,验证可编辑 2. 测试打开3个文件,删除焦点文件,重启,验证所有标签页可编辑 3. 测试正常重启已有文件场景仍然正常 PMS: BUG-376141
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx 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 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes editor recovery when the focused file was deleted or moved by explicitly loading a remaining pending tab at index 0, avoiding reliance on a non-emitted currentChanged signal while preserving normal tab activation behavior. Sequence diagram for recovery when the focused file is missingsequenceDiagram
participant StartManager
participant Window
participant Tabbar
StartManager->>Tabbar: count()
StartManager->>Tabbar: fileAt(0)
StartManager->>Window: isPendingTab(firstFile)
alt first tab is pending
StartManager->>Window: loadPendingTab(firstFile)
end
StartManager->>Window: activeTab(0)
Window->>Tabbar: setCurrentIndex(0)
Note over Window,Tabbar: currentChanged is not emitted when index is already 0
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
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/startmanager.cpp" line_range="513-515" />
<code_context>
+ // 当仅剩 pending 标签页时,currentIndex 可能已被 addPendingTab 隐式设为 0,
+ // activeTab(0) 内部的 setCurrentIndex(0) 不会触发 currentChanged 信号,
+ // 导致 pending 标签页永远不被加载。此处显式加载第一个 pending 标签页。
+ QString firstFile = window->getTabbar()->fileAt(0);
+ if (window->isPendingTab(firstFile)) {
+ window->loadPendingTab(firstFile);
+ }
window->activeTab(0);
</code_context>
<issue_to_address>
**Earlier windows stay unloaded**
When recovery spans multiple windows and the saved focus-file record is skipped, `recoverFile` calls `loadPendingTab` only on the final `window`. Earlier windows have already selected their first pending tab while signals are blocked, so `handleCurrentChanged` does not load it; those windows remain without an editor until the user switches tabs.
Load the first pending tab in every recovered window, not only the final `window`.
</issue_to_address>| QString firstFile = window->getTabbar()->fileAt(0); | ||
| if (window->isPendingTab(firstFile)) { | ||
| window->loadPendingTab(firstFile); |
There was a problem hiding this comment.
🟡 Medium · Earlier windows stay unloaded
When recovery spans multiple windows and the saved focus-file record is skipped, recoverFile calls loadPendingTab only on the final window. Earlier windows have already selected their first pending tab while signals are blocked, so handleCurrentChanged does not load it; those windows remain without an editor until the user switches tabs.
Load the first pending tab in every recovered window, not only the final window.
Prompt for AI agents
In `src/startmanager.cpp` at lines 513-515:
**Earlier windows stay unloaded**
When recovery spans multiple windows and the saved focus-file record is skipped, `recoverFile` calls `loadPendingTab` only on the final `window`. Earlier windows have already selected their first pending tab while signals are blocked, so `handleCurrentChanged` does not load it; those windows remain without an editor until the user switches tabs.
Load the first pending tab in every recovered window, not only the final `window`.
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['建议:loadPendingTab(firstFile) 调用后仍执行 activeTab(0),若 loadPendingTab 内部 会改变标签页数量或顺序,可确认 activeTab(0) 仍指向预期标签页,避免潜在的双重操作。 当前实现合理,此为防御性建议。'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 当前实现已为正确的修复方式,无需修改。完整上下文如下:
} else if (recFilesSum > 0 && window->getTabbar()->count() > 0) {
// 焦点标签页文件不存在或无焦点记录,加载第一个可用标签页
qDebug() << "No focus tab available, loading first tab";
// 当仅剩 pending 标签页时,currentIndex 可能已被 addPendingTab 隐式设为 0,
// activeTab(0) 内部的 setCurrentIndex(0) 不会触发 currentChanged 信号,
// 导致 pending 标签页永远不被加载。此处显式加载第一个 pending 标签页。
QString firstFile = window->getTabbar()->fileAt(0);
if (window->isPendingTab(firstFile)) {
window->loadPendingTab(firstFile);
}
window->activeTab(0);
}本报告由 AI 代码审查工具自动生成 |
|
TAG Bot New tag: 6.6.8 |
fix: load pending tab when focus file missing
Log: Fix editor unable to edit after restart when focus file deleted
Influence:
fix: 焦点文件缺失时加载待加载标签页
Log: 修复焦点文件被删除后重启编辑器无法编辑的问题
Influence:
PMS: BUG-376141
Summary by Sourcery
Bug Fixes: