Repository navigation
fix: remove dead DPrinter causing print preview delay - #686
Merged
deepin-bot[bot] merged 1 commit intoOct 23, 2026
Merged
Conversation
1. Root cause: popupPrintDialog() constructs a DPrinter(QPrinter:: HighResolution) local variable that is never used; QPrinter NativeFormat construction synchronously loads the cups plugin and enumerates printers, blocking the UI thread for several seconds 2. Fix: remove the dead DPrinter line introduced by commit 9fcf3e4, whose配套 setOutputFileName/setDocName calls were already removed during API migration but the constructor was left behind 3. Impact: print preview opens faster by eliminating one redundant synchronous printer query; no behavior change since the variable was never referenced Log: 优化打印预览页面打开速度,移除冗余的 DPrinter 构造 Influence: 1. Test print preview opens promptly for syntax-highlighted files 2. Verify print preview dialog functions normally (print, preview) 3. Test print preview with plain text files fix: 移除导致打印预览延迟的死代码 DPrinter 1. 根因:popupPrintDialog() 中构造了 DPrinter(QPrinter::HighResolution) 局部变量但从未使用,QPrinter NativeFormat 构造时同步加载 cups 插件并枚举打印机,阻塞 UI 线程数秒 2. 方案:删除由 commit 9fcf3e4 引入的死代码行,其配套的 setOutputFileName/setDocName 调用在接口迁移中已移除,唯独构造残留 3. 影响:打印预览打开速度提升,消除一次冗余的同步打印机查询, 因变量从未被引用,无行为变化 Log: 优化打印预览页面打开速度,移除冗余的 DPrinter 构造 Influence: 1. 测试语法高亮文件的打印预览打开速度 2. 验证打印预览对话框功能正常(打印、预览) 3. 测试纯文本文件的打印预览 PMS: BUG-375053
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe pull request removes dead DPrinter initialization from popupPrintDialog(), eliminating an unnecessary synchronous CUPS/printer query so print previews open faster without changing dialog behavior. Sequence diagram for faster print preview openingsequenceDiagram
participant User
participant Window
participant CUPS
participant DPrintPreviewDialog
User->>Window: popupPrintDialog()
Note over Window,CUPS: Before: DPrinter(QPrinter::HighResolution) synchronously queried printers
Window->>CUPS: Enumerate printers
CUPS-->>Window: Printer information
Window->>DPrintPreviewDialog: new DPrintPreviewDialog(this)
Window-->>User: Print preview opens
User->>Window: popupPrintDialog()
Window->>DPrintPreviewDialog: new DPrintPreviewDialog(this)
Window-->>User: Print preview opens promptly
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: 无需修改 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: 无需修改 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: 无需修改 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: 无需修改 💡 改进建议代码示例无需修改,当前代码已正确移除了死代码。本报告由 AI 代码审查工具自动生成 |
lzwind
approved these changes
Oct 23, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, pengfeixx 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
|
/merge |
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: remove dead DPrinter causing print preview delay
HighResolution) local variable that is never used; QPrinter
NativeFormat construction synchronously loads the cups plugin and
enumerates printers, blocking the UI thread for several seconds
whose配套 setOutputFileName/setDocName calls were already removed
during API migration but the constructor was left behind
synchronous printer query; no behavior change since the variable
was never referenced
Log: 优化打印预览页面打开速度,移除冗余的 DPrinter 构造
Influence:
fix: 移除导致打印预览延迟的死代码 DPrinter
局部变量但从未使用,QPrinter NativeFormat 构造时同步加载 cups
插件并枚举打印机,阻塞 UI 线程数秒
setOutputFileName/setDocName 调用在接口迁移中已移除,唯独构造残留
因变量从未被引用,无行为变化
Log: 优化打印预览页面打开速度,移除冗余的 DPrinter 构造
Influence:
PMS: BUG-375053
Summary by Sourcery
Bug Fixes: