[1256] 修复含 \< 的文档反复选中后排版引擎卡死 - #4472
Open
da-liii wants to merge 2 commits into
Open
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.
问题
打开含
<math|(m \< n)>的文档,在公式附近反复选中/框选后,排版引擎永久卡死:UI 线程和 Qt 事件循环正常,但文档不再重绘、输入无响应。根因
\<解析出的公式树结构异常,拖动选中时 moebiuspre_correct()命中TM_FAILED ("bad path")抛出 C++string异常。鼠标事件走延迟路径(delayed_call_mouse_event→command_queue::exec_pending())时没有任何异常保护,异常穿过 s7 解释器从qt_gui_rep::update()逃逸,导致:updatetimer停在停止状态、updating永远为true;修复(双层防御,均在
qt_gui.cpp)command_queue::exec_pending()逐条try/catch (string):失败的延时命令丢弃并继续后续命令;qt_gui_rep::update()整体兜底try/catch (string):无论哪一环抛异常,末尾的定时器重启与updating=false必然执行。验证
修复前 4/4 轮复现(均在第一批 ~10 次操作内卡死);修复后 2 轮各 800 次混合操作全程存活,日志中 90 次
bad path异常全部被捕获丢弃。详见devel/1256.md。后续
\<的规范化处理(应为<less>)另开任务,从源头消除异常。