Repository navigation
fix: add null check for PageSingleInfo cast in RichTextDelegate - #870
Merged
deepin-bot[bot] merged 1 commit intoOct 26, 2026
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRichTextDelegate::paint now safely handles non-PageSingleInfo parents by conditionally updating row height while preserving existing rendering and PageSingleInfo behavior. Sequence diagram for safe RichTextDelegate paintingsequenceDiagram
participant View as View
participant Delegate as RichTextDelegate
participant Parent as ParentWidget
participant PageInfo as PageSingleInfo
participant Painter as QPainter
View->>Delegate: paint(painter, option, index)
Delegate->>Parent: dynamic_cast<PageSingleInfo*>()
alt parent is PageSingleInfo
Parent-->>Delegate: PageSingleInfo*
Delegate->>PageInfo: setRowHeight(index.row(), height + 6)
else parent is another widget
Parent-->>Delegate: nullptr
end
Delegate->>Painter: draw text document
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1. RichTextDelegate::paint dereferences dynamic_cast result without null check when parent is not PageSingleInfo 2. Add null pointer check before calling setRowHeight to prevent crash 3. No behavior change when parent is PageSingleInfo, only skips setRowHeight when parent is other type like PageTableWidget 4. Update SPDX copyright year from 2022 to 2022-2026 for CI compliance Influence: 1. Test RichTextDelegate with PageSingleInfo parent and multi-line text 2. Test RichTextDelegate with PageTableWidget parent and multi-line text 3. Verify no crash and text rendering is correct in both cases fix: RichTextDelegate::paint 增加空指针检查防止崩溃 1. RichTextDelegate::paint 在 parent 非 PageSingleInfo 时 dynamic_cast 返回空指针后直接解引用导致崩溃 2. 增加 dynamic_cast 结果空指针检查后再调用 setRowHeight 3. parent 为 PageSingleInfo 时行为不变,为其他类型时跳过 setRowHeight 调用不影响文本绘制 4. 更新 SPDX 版权年份从 2022 为 2022-2026 以满足 CI 检查 Influence: 1. 测试 parent 为 PageSingleInfo 时多行文本绘制正常 2. 测试 parent 为 PageTableWidget 时多行文本不崩溃 3. 验证两种场景下文本渲染结果正确
add-uos
force-pushed
the
agent/pms-bug-bot/266b66d9b98b
branch
from
October 26, 2026 03:09
53fac78 to
3aa0450
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 当前代码已是最佳实践,无需额外修改: PageSingleInfo *pageInfo = dynamic_cast<PageSingleInfo *>(this->parent()); if (pageInfo) {
pageInfo->setRowHeight(index.row(), textDoc.size().toSize().height() + 6);
}本报告由 AI 代码审查工具自动生成 |
lzwind
approved these changes
Oct 26, 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
|
/forcemerge |
Contributor
|
This pr force merged! (status: unstable) |
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.
fix: add null check for PageSingleInfo cast in RichTextDelegate
null check when parent is not PageSingleInfo
setRowHeight when parent is other type like PageTableWidget
Influence:
fix: RichTextDelegate::paint 增加空指针检查防止崩溃
dynamic_cast 返回空指针后直接解引用导致崩溃
setRowHeight 调用不影响文本绘制
Influence:
Summary by Sourcery
Bug Fixes: