Skip to content

fix(appmgr): defer apps until theme icon resolves - #794

Open
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0811/bug-371833-qicon-isnull
Open

fix(appmgr): defer apps until theme icon resolves#794
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0811/bug-371833-qicon-isnull

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
  1. Add resolvedIconPath() to check if a theme icon name resolves to a real icon via QIcon::fromTheme
  2. Defer newly added app items with unresolved theme icons to the pending queue and start the check timer
  3. Reload theme search paths on each pending check so icons appearing after startup become visible
  4. Promote pending items once their icon resolves; force-process leftovers after the 120s timeout
  5. Extend the pending-item timeout from 60s to 120s to cover slow theme initialization

Log: Defer app items with unresolvable theme icons until the icon becomes available, then promote them.
Influence: Apps with null icons now show once the icon is available.

fix(appmgr): 主题图标未解析的应用延迟到图标可用后再添加

  1. 新增 resolvedIconPath(),通过 QIcon::fromTheme 判断主题图标名是否可解析为真实图标
  2. 图标未解析的新增应用项先放入待处理队列并启动检查定时器
  3. 每次待处理检查时刷新主题搜索路径,使启动后新出现的图标可见
  4. 图标可解析后立即提升待处理项,超过 120 秒超时则强制处理剩余项
  5. 待处理项超时从 60 秒延长至 120 秒,以覆盖主题初始化较慢的场景

Log: 将主题图标无法解析的应用延迟处理,待图标可用后再提升。
PMS: BUG-371833
Influence: 图标为 null 的应用在图标可用后正常显示。

Summary by Sourcery

Defer adding app items whose theme-based icons are not yet resolvable, and promote them once their icons become available.

Bug Fixes:

  • Ensure apps with initially null or unresolved theme icons appear once the icon becomes available instead of being added with missing icons.

Enhancements:

  • Introduce a helper to resolve theme icon names and provide a default icon when none is set.
  • Reload icon theme search paths during pending app checks so icons that appear after startup are detected.
  • Extend the pending-app check timeout from 60 to 120 seconds before force-processing remaining items.

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

Sorry @MyLeeJiEun, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MyLeeJiEun

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

@deepin-ci-robot

Copy link
Copy Markdown

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a theme-icon resolution helper and defers new app items whose icons are not yet resolvable, periodically rechecking and promoting them when icons become available while extending the pending timeout window.

Sequence diagram for deferred app item icon resolution

sequenceDiagram
    actor AppSource
    participant AppMgr
    participant QIconTheme as QIcon

    AppSource->>AppMgr: watchingAppItemAdded(key, appItem)
    AppMgr->>AppMgr: resolvedIconPath(appItem)
    AppMgr->>QIconTheme: QIcon::fromTheme(appItem->iconName)
    alt icon resolvable
        QIconTheme-->>AppMgr: non-null QIcon
        AppMgr->>AppMgr: appItem->iconName = resolved
        AppMgr-->>AppSource: app item added with icon
    else icon not resolvable
        QIconTheme-->>AppMgr: null QIcon
        AppMgr->>AppMgr: m_pendingAppItems[key] = appItem
        AppMgr->>AppMgr: m_checkTimer->start()
    end

    loop periodic icon checks
        AppMgr->>AppMgr: checkPendingAppItems()
        AppMgr->>QIconTheme: QIcon::setThemeSearchPaths(QIcon::themeSearchPaths())
        AppMgr->>AppMgr: resolvedIconPath(appItem)
        AppMgr->>QIconTheme: QIcon::fromTheme(appItem->iconName)
        alt icon now resolvable
            QIconTheme-->>AppMgr: non-null QIcon
            AppMgr->>AppMgr: appItem->iconName = resolved
            AppMgr->>AppMgr: itemsToProcess.append(key, appItem)
            AppMgr->>AppSource: promote app item
        else still unresolved and timeout not reached
            AppMgr->>AppMgr: keep in m_pendingAppItems
        else timeout reached (m_checkCount >= 40)
            AppMgr->>AppMgr: force process remaining pending items
            AppMgr->>AppSource: add app items even without icons
        end
    end
Loading

File-Level Changes

Change Details Files
Defer newly added app items with unresolved theme icons and promote them once icons resolve or timeout
  • In watchingAppItemAdded, call a new icon resolution helper for non-absolute icon names and enqueue app items with unresolved icons into the pending map, starting the check timer if needed
  • In checkPendingAppItems, for theme-name icons, re-run icon resolution on each check, promote items whose icons now resolve, and continue to defer unresolved items
  • Increase the pending check timeout window from 60s to 120s by doubling the allowed check count before forcing processing of remaining pending items
src/ddeintegration/appmgr.cpp
Introduce a theme icon resolution helper based on QIcon::fromTheme and update theme search paths during pending checks
  • Add QIcon include and a resolvedIconPath helper that maps empty icon names to a default desktop-icon name and uses QIcon::fromTheme to determine if the icon is available
  • Call QIcon::setThemeSearchPaths(QIcon::themeSearchPaths()) at the start of each pending-check run to refresh theme search paths
  • Declare the resolvedIconPath helper in the AppMgr header for use in appmgr.cpp
src/ddeintegration/appmgr.cpp
src/ddeintegration/appmgr.h

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

1. Add resolvedIconPath() to check if a theme icon name resolves to a real icon via QIcon::fromTheme
2. Defer newly added app items with unresolved theme icons to the pending queue and start the check timer
3. Reload theme search paths on each pending check so icons appearing after startup become visible
4. Promote pending items once their icon resolves; force-process leftovers after the 120s timeout
5. Extend the pending-item timeout from 60s to 120s to cover slow theme initialization

Log: Defer app items with unresolvable theme icons until the icon becomes available, then promote them.
Influence: Apps with null icons now show once the icon is available.

fix(appmgr): 主题图标未解析的应用延迟到图标可用后再添加

1. 新增 resolvedIconPath(),通过 QIcon::fromTheme 判断主题图标名是否可解析为真实图标
2. 图标未解析的新增应用项先放入待处理队列并启动检查定时器
3. 每次待处理检查时刷新主题搜索路径,使启动后新出现的图标可见
4. 图标可解析后立即提升待处理项,超过 120 秒超时则强制处理剩余项
5. 待处理项超时从 60 秒延长至 120 秒,以覆盖主题初始化较慢的场景

Log: 将主题图标无法解析的应用延迟处理,待图标可用后再提升。
PMS: BUG-371833
Influence: 图标为 null 的应用在图标可用后正常显示。
@MyLeeJiEun
MyLeeJiEun force-pushed the fork-from-master-0811/bug-371833-qicon-isnull branch from 887d2cf to 571dce2 Compare August 12, 2026 05:53
// initialized at startup). For: bug-347859, bug-371833.
const bool resolvable = QFileInfo(iconName).isAbsolute()
? QFileInfo::exists(iconName)
: iconName.isEmpty() || !QIcon::fromTheme(iconName).isNull();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

QIcon::fromTheme不能判断路径么?

++m_checkCount;

// Reload theme search paths so icons appearing after startup become visible.
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个会清除所有已经加载了的图标的,真的要每次都执行一次么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants