Skip to content

fix: repair Qt6 build of the svg icon cache pool - #329

Merged
18202781743 merged 1 commit into
linuxdeepin:masterfrom
mhduiy:fix-dsvgicon-qt6-concurrent-run
Sep 23, 2026
Merged

18202781743 merged 1 commit into
linuxdeepin:masterfrom
mhduiy:fix-dsvgicon-qt6-concurrent-run

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

The Dtk6 packaging build (-DDTK5=OFF, Qt 6.8) fails to compile
iconengineplugins/svgiconengine/qsvgiconengine.cpp, so dde-qt6integration
cannot be built. Introduced by #327.

qfuture_impl.h:179:43: error: 'operator()' is not a member of 'std::decay<IconCachePool*>::type'
qtconcurrentstoredfunctioncall.h:189:64: error: no type named 'IsPromise' in 'struct QtPrivate::ArgResolver<IconCachePool*>'

IconCachePool derives from QThreadPool, so QtConcurrent::run(pool, function)
now passes an IconCachePool*. In Qt 6 the argument resolves as follows:

candidate conversion for IconCachePool*
run(QThreadPool *pool, Function &&, Args &&...) derived-to-base pointer conversion
run(Function &&, Args &&...) (global pool) identity, i.e. exact match

Conversion rank is compared before template partial ordering, so the global-pool
overload wins, Function is deduced as IconCachePool*, and the error surfaces
inside QtPrivate::ArgResolver. Previously the call passed
QThreadPool::globalInstance() directly, which is an exact QThreadPool* match
for 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 bogus run(Functor, const Arg1 &) candidate
is discarded and only the run(QThreadPool *, Functor) overload remains.

Fix: pass the pool as an explicit QThreadPool *, which restores the Qt 6 overload
that was selected before #327. Behavior is unchanged: the cache write still runs on
IconCachePool.

Validation:

  • cmake --build build6 --target dsvgicon and cmake --build build5 --target dsvgicon (Qt 6.8 / Qt 5.15) both link
  • dpkg-buildpackage -b -uc -us -j12: dh_auto_build completes for both build5 and build6
  • Runtime smoke test loading each built libdsvgicon.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×64

Summary by Sourcery

Fix SVG icon cache pool scheduling so the Qt 6 integration builds successfully without changing cache behavior.

Bug Fixes:

  • Restore Qt 6 SVG icon cache pool builds by ensuring cache writes use the intended QThreadPool overload.

Build:

  • Fix compatibility with Qt 6 while preserving Qt 5 SVG icon engine builds.

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 恢复构建,缓存写行为不变
@sourcery-ai

sourcery-ai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Fixes 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 dispatch

sequenceDiagram
    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
Loading

File-Level Changes

Change Details Files
Disambiguate the QtConcurrent overload so cache writes continue to execute on the dedicated icon cache thread pool under Qt 6.
  • Explicitly cast the derived pool instance to QThreadPool* before calling QtConcurrent::run.
  • Move the function object into the selected pool-aware overload.
  • Retain an empty future when the cache pool instance is unavailable.
iconengineplugins/svgiconengine/qsvgiconengine.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 未发现安全漏洞和代码质量问题。本次提交修复了 Qt6 下 QtConcurrent::run 的重载解析问题,修改正确、简洁,符合提交目的。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 暂无代码示例

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@18202781743
18202781743 merged commit e19a2c7 into linuxdeepin:master Sep 23, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants