Skip to content

fix(Tutorial):修复了“编辑主界面”窗口报错、崩溃的问题(issue#1829)#1837

Merged
HelloWRC merged 2 commits into
ClassIsland:masterfrom
wan-an-zz:fix-issue#1829
Jun 11, 2026
Merged

fix(Tutorial):修复了“编辑主界面”窗口报错、崩溃的问题(issue#1829)#1837
HelloWRC merged 2 commits into
ClassIsland:masterfrom
wan-an-zz:fix-issue#1829

Conversation

@wan-an-zz

Copy link
Copy Markdown
Contributor

这个 Pull Request 做了什么?

issue#1829的复现

在主界面中加入除分割线和日期外的任意一个组件后,打开教学 -> 组件编辑·入门 -> 启动“添加组件”教学,出现报错,屏幕右侧出现“组件设置”的第一条Sentence的内容,且其不被TeachingTip控件所包裹。

问题溯源

用户启动"添加组件"(addComponent) 教程
    → StartParagraph(tutorial, addComponent)
      → InvokeActions(paragraph.InitializeActions, true) 
        → EnterEditMode()    
          → 存在多次调用BeginNotCompletedTutorials()的可能,以下只取其中一个被调用后的调用链
            → BeginTutorial → JumpToParagraph
              → StartParagraph()      // ← 二次调用
                → StartSentence()
                  → 创建 TeachingTip + Dispatcher.Post(IsOpen = true)
      → StartSentence(addComponent.Content[0])                // 外层调用继续
        → CleanupPrevSentence()
          → 移除BeginNotCompletedTutorials()链路下产生的 TeachingTip(从 AdornerLayer 分离)
          → CurrentTeachingTip = null
      → 创建 addComponent 的 TeachingTip + Dispatcher.Post(IsOpen = true)

  Dispatcher 处理队列:
    → 在BeginNotCompletedTutorials()下的链路中调用StartSentence()产生的 TeachingTip.IsOpen = true
      → TeachingTip.OnPopupOpened → NRE(TeachingTip 已被从 Visual Tree 分离)

BeginTutorial 的守卫 IsTutorialRunning 检查的是 CurrentSentence != null,但在第一个StartParagraph()执行期间,CurrentSentence 尚未设置(要等到 StartSentence() 才设置),而重入恰好在 InvokeActions() 阶段发生——此时IsTutorialRunning 返回 false,守卫完全失效。

修复

IsTutorialRunning的值取CurrentParagraph is not nullCurrentSentence is not null的或运算结果,确保IsTutorialRunning代表Tutorial运行的真实状态。

相关 Issue

Fixes #1829

检查清单

  • 我已经在本地测试过这个 PR,确保欲实现的功能或修复的问题能正常工作。

@wan-an-zz wan-an-zz requested review from a team and HelloWRC as code owners June 6, 2026 17:41
@HelloWRC HelloWRC merged commit b687995 into ClassIsland:master Jun 11, 2026
2 checks passed
@HelloWRC

Copy link
Copy Markdown
Member

感谢您的贡献🤝

昔涟 爱

@wan-an-zz wan-an-zz deleted the fix-issue#1829 branch June 11, 2026 04:23
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