Repository navigation
[6253] 修复 AI 操作栏异常导致应用崩溃 - #4812
Merged
Merged
Conversation
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.
问题
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 点击后稳定输出:
修复后通过,并继续完成第二次动作:
本地检查
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。tests/mogan/python/6253.py --reproduce:独立对照稳定复现SIGABRT。验收范围
按任务约定使用无 GUI 子进程复现与 Qt 真实点击回归,不启动桌面应用,不依赖模型插件;未运行人工 GUI 验收。
配套任务文档与稳定复现脚本见 dev-agent 6253 PR。