fix(reader): keep restore-tip notify flag on tab switch during startup restore - #374
Merged
Merged
Conversation
Reviewer's GuideFixes startup restoration across multiple tabs by retaining deferred restore-tip notifications during tab switching, while also hardening render-thread shutdown synchronization and making the affected unit test deterministic. Sequence diagram for preserving restore-tip notifications on tab switchsequenceDiagram
participant Startup as StartupRestore
participant Sheet as DocSheet
participant Layout as Layout
participant Tab as CentralDocPage
participant Timer as RestoreSettleTimer
Startup->>Sheet: beginRestoreGuard(true)
Sheet->>Layout: onLayoutSettled
alt tab is not visible
Layout-->>Sheet: restore deferred
Tab->>Sheet: onTabChanged
Sheet->>Sheet: restoreSavedViewState
alt m_restoreGuardActive
Sheet->>Timer: start(kRestoreSettleMs)
Note over Sheet,Timer: m_restoreNotifyTip remains true
else guard is inactive
Sheet->>Sheet: beginRestoreGuard(false)
end
else tab is visible
Layout-->>Sheet: restore completes
end
Sequence diagram for safe PageRenderThread shutdownsequenceDiagram
participant Main as MainThread
participant Render as PageRenderThread
Main->>Render: destroyForever
Render->>Render: m_quit = true
Render-->>Main: wait
Render->>Render: run
Render->>Render: check m_quit
Render-->>Main: thread exits
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…p restore When reopening with multiple documents, deferred restore guards of background tabs had their notify flag overwritten by restoreSavedViewState() calling beginRestoreGuard(false), so the "restored to last reading position" tip never showed for those tabs. 启动期多文档恢复时,后台页签的恢复守卫被顺延;首次切到该页签时 restoreSavedViewState() 用 beginRestoreGuard(false) 覆盖了待弹条的 通知标志,导致恢复完成后提示条永不出现。 Log: 多文档恢复时保留顺延守卫的弹条通知标志,修复仅首个文档有恢复提示条的问题 PMS: BUG-376441 Influence: 恢复会话中每个有阅读进度的标签页首次切换过去时都会弹出恢复提示条;恢复已完成的页签回切行为不变。
add-uos
force-pushed
the
feature/fix-BUG376441
branch
from
September 9, 2026 07:59
6567313 to
47efe42
Compare
lzwind
approved these changes
Sep 9, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind 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.
问题
BUG-376441:打开多个文档并滚动产生阅读进度后关闭文档查看器,再次打开时只有一个文档显示"已恢复到上次阅读位置"提示条,其余标签页永不显示。
根因
启动期多文档恢复时,非可见页签的恢复守卫(
beginRestoreGuard(true))在onLayoutSettled中因页签不可见被顺延,m_restoreNotifyTip=true处于待消费状态。用户首次切到该页签时,CentralDocPage::onTabChanged→DocSheet::restoreSavedViewState()无条件调用beginRestoreGuard(false),把待消费的通知标志覆盖为 false。随后恢复流程正常完成,但m_needsRestoreTip永不置位,标签切换时提示条显隐分支永远判 false。只有启动时恰好可见的活跃标签(上次会话的活跃文档)能在覆盖发生前完成恢复并弹条,与 bug 现象完全吻合。
修复
restoreSavedViewState()中,若恢复守卫已激活(顺延中的首次恢复),保留其弹条通知标志,仅重启稳定计时等待布局对齐;守卫未激活时保持原有"回切不弹条"行为。修复后每个有阅读进度的标签页首次切换过去时会恢复滚动位置并弹出提示条;关闭提示条/跳转首页后不再打扰(原有行为不变)。
验证
.pms/bugs/376441/analysis-report.md。PMS: BUG-376441
Summary by Sourcery
Bug Fixes: