Skip to content

[6253] 修复 AI 操作栏异常导致应用崩溃 - #4812

Merged
PinkMagicFly merged 1 commit into
mainfrom
pigmagicfly/6253/ai-action-exception-crash
Nov 25, 2026
Merged

PinkMagicFly merged 1 commit into
mainfrom
pigmagicfly/6253/ai-action-exception-crash

Conversation

@PinkMagicFly

Copy link
Copy Markdown
Contributor

问题

AI 选区操作栏的 QML 点击直接进入 QTMAiActionsBar::onActionTriggered(),编辑器动作可能抛出项目 string 异常(例如只读或排版期间写入输入缓冲抛出 read-only)。异常越过 Qt 槽后触发 SIGABRT,导致应用退出。

安装版崩溃报告显示 QQuickMouseArea::clicked → QML → __cxa_rethrow → std::__terminate → abort;11 月 24 日日志也包含 qt_gui: exception during update: read-only。

修复

  • 在 QTMAiActionsBar::onActionTriggered() 捕获项目 string 异常,防止其穿透 QML 回调。
  • 记录 AI action failed,使用既有 handle_exceptions() 清理异常状态,并 disarm() 操作栏。
  • 将最终 ed->ai_action() 抽为受保护虚函数 performAction(),保持生产分派不变,允许测试只替换最后一步稳定注入异常。
  • 新增真实 QTMAiActionsBar / AiActionsBar.qml 点击回归,验证异常不退出进程、异常状态被清理且后续动作仍可执行。

不修改 QML、AI 插件、正常动作分派、聊天内容或发送行为。

红绿验证

修复前,新测试在 QML 点击后稳定输出:

uncaught exception of type string
Received signal 6 (SIGABRT)

修复后通过,并继续完成第二次动作:

AI action failed: read-only
Totals: 3 passed, 0 failed

本地检查

  • xmake build --yes qt_ai_actions_bar_test qml_load_test:PASS。
  • xmake run --yes qt_ai_actions_bar_test:3 passed / 0 failed。
  • xmake run --yes qml_load_test:41 passed / 0 failed。
  • xmake build --yes stem:PASS。
  • gf fmt --changed-since=main:PASS,无额外格式改动。
  • git diff --check:PASS。
  • dev-agent tests/mogan/python/6253.py --reproduce:独立对照稳定复现 SIGABRT。

验收范围

按任务约定使用无 GUI 子进程复现与 Qt 真实点击回归,不启动桌面应用,不依赖模型插件;未运行人工 GUI 验收。

配套任务文档与稳定复现脚本见 dev-agent 6253 PR。

@PinkMagicFly
PinkMagicFly merged commit 0d24e59 into main Nov 25, 2026
5 of 6 checks passed
@PinkMagicFly
PinkMagicFly deleted the pigmagicfly/6253/ai-action-exception-crash branch November 25, 2026 10:22
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.

1 participant