fix: repair Qt6 build of the svg icon cache pool - #329
Conversation
1. Pass the IconCachePool instance to QtConcurrent::run as an explicit QThreadPool* so the thread-pool overload is selected 2. Fix the Qt6 build break in IconCachePool::run, where the derived IconCachePool* argument made run(Function&&, Args&&...) an exact match and the promise resolver failed to instantiate 3. Move the functor into QtConcurrent::run to avoid an extra copy Log: Restore the Qt6 build of the dsvgicon plugin without runtime change Influence: dde-qt6integration builds; cache writes unchanged fix: 修复 svg 图标缓存线程池在 Qt6 下的编译失败 1. 传入 QtConcurrent::run 的线程池显式转换为 QThreadPool*,确保选中线程池重载 2. 修复 IconCachePool::run 的 Qt6 编译失败:派生类指针 IconCachePool* 使 run(Function&&, Args&&...) 成为精确匹配,导致 promise 解析器实例化报错 3. 以 std::move 传递仿函数,避免一次多余拷贝 Log: 恢复 dsvgicon 插件在 Qt6 下的构建,运行行为不变 Influence: dde-qt6integration 恢复构建,缓存写行为不变
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes the Qt 6 SVG icon cache build by forcing QtConcurrent::run to select its QThreadPool overload instead of treating IconCachePool* as a callable; runtime behavior remains unchanged, with cache writes still performed on IconCachePool. Validation covers Qt 5 and Qt 6 builds, packaging, and cache-rendering smoke tests. Sequence diagram for SVG icon cache write dispatchsequenceDiagram
participant IconEngine
participant IconCachePool
participant QtConcurrent
participant QThreadPool
participant Cache
IconEngine->>IconCachePool: run(function)
IconCachePool->>QtConcurrent: run(static_cast<QThreadPool *>(pool), std::move(function))
QtConcurrent->>QThreadPool: enqueue function
QThreadPool->>Cache: write cache PNG
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. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 暂无代码示例本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy 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 |
The
Dtk6packaging build (-DDTK5=OFF, Qt 6.8) fails to compileiconengineplugins/svgiconengine/qsvgiconengine.cpp, sodde-qt6integrationcannot be built. Introduced by #327.
IconCachePoolderives fromQThreadPool, soQtConcurrent::run(pool, function)now passes an
IconCachePool*. In Qt 6 the argument resolves as follows:IconCachePool*run(QThreadPool *pool, Function &&, Args &&...)run(Function &&, Args &&...)(global pool)Conversion rank is compared before template partial ordering, so the global-pool
overload wins,
Functionis deduced asIconCachePool*, and the error surfacesinside
QtPrivate::ArgResolver. Previously the call passedQThreadPool::globalInstance()directly, which is an exactQThreadPool*matchfor both candidates; partial ordering then picked the thread-pool overload.
Qt 5 is not affected: its functor overloads are SFINAE-guarded on their return
type (
qtconcurrentrun.h:111), so the bogusrun(Functor, const Arg1 &)candidateis discarded and only the
run(QThreadPool *, Functor)overload remains.Fix: pass the pool as an explicit
QThreadPool *, which restores the Qt 6 overloadthat was selected before #327. Behavior is unchanged: the cache write still runs on
IconCachePool.Validation:
cmake --build build6 --target dsvgiconandcmake --build build5 --target dsvgicon(Qt 6.8 / Qt 5.15) both linkdpkg-buildpackage -b -uc -us -j12:dh_auto_buildcompletes for bothbuild5andbuild6libdsvgicon.so, rendering a real SVG and reading back the cache PNG (D_ICON_CACHE_PATH): pixmap 64×64 rendered, cache file written on a pooled thread within 50 ms, cached image 64×64Summary by Sourcery
Fix SVG icon cache pool scheduling so the Qt 6 integration builds successfully without changing cache behavior.
Bug Fixes:
Build: