From 645b181b12519f8bdc5c28e814c6f6e1b50113e1 Mon Sep 17 00:00:00 2001 From: zhangkun2 Date: Mon, 14 Sep 2026 12:23:25 +0800 Subject: [PATCH] fix(appmgr): revert theme icon defer to fix slow app loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert the theme-icon deferral introduced in commit 521429e ("fix(appmgr): defer apps until theme icon resolves"). That change extended waitForIcon() to also defer apps whose theme-name icon QIcon::fromTheme() cannot resolve at startup, causing a large number of apps to be queued and released only every 3s (up to 120s timeout) — visible as slow/progressive app loading in windowed launcher mode. Restore the original behaviour: only defer apps with absolute-path icons whose file does not exist yet (bug-347859). Theme icons that become available after startup are handled by the existing DFileWatcherManager + updateIconData() mechanism in AppsModel. Log: Revert theme icon defer logic to fix slow progressive app loading in windowed launcher. PMS: BUG-372641 Influence: Windowed launcher now shows all apps immediately instead of progressive loading. fix(appmgr): 回退主题图标延迟逻辑以修复应用加载缓慢 回退 commit 521429e("fix(appmgr): defer apps until theme icon resolves")引入的主题图标延迟逻辑。该改动扩展了 waitForIcon(), 使主题图标名在 QIcon::fromTheme() 中暂时无法解析的应用也被延迟, 导致启动器启动时大量应用被放入待处理队列,每 3 秒才逐步释放 (最长 120 秒超时)——在窗口模式下表现为应用加载缓慢和渐进式滚动效果。 恢复原有行为:仅延迟绝对路径图标文件尚不存在的应用(bug-347859)。 主题图标延迟可用的问题由 AppsModel 中现有的 DFileWatcherManager + updateIconData() 机制处理。 Log: 回退主题图标延迟逻辑,修复窗口模式启动器应用渐进式加载缓慢问题。 PMS: BUG-372641 Influence: 窗口模式启动器现在一次性显示所有应用,不再渐进式加载。 --- src/ddeintegration/appmgr.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/ddeintegration/appmgr.cpp b/src/ddeintegration/appmgr.cpp index c2e70654..6e8833ba 100644 --- a/src/ddeintegration/appmgr.cpp +++ b/src/ddeintegration/appmgr.cpp @@ -3,7 +3,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "appmgr.h" -#include "iconutils.h" #include #include @@ -11,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -224,13 +222,7 @@ bool AppMgr::removeFromDesktop(const QString &desktopId) // For: bug-347859 bool AppMgr::waitForIcon(const QString &desktopId, const QString &iconName) { - // Defer the row until its icon is resolvable: an absolute path that does - // not exist yet, or a theme-name icon QIcon cannot resolve yet (theme not - // initialized at startup). For: bug-347859, bug-371833. - const bool resolvable = QFileInfo(iconName).isAbsolute() - ? QFileInfo::exists(iconName) - : iconName.isEmpty() || !QIcon::fromTheme(iconName).isNull(); - if (desktopId.isEmpty() || resolvable) { + if (desktopId.isEmpty() || !QFileInfo(iconName).isAbsolute() || QFileInfo::exists(iconName)) { cancelPendingAppItem(desktopId); return false; } @@ -269,15 +261,9 @@ void AppMgr::checkPendingAppItems() { ++m_checkCount; - // Reload theme search paths so icons appearing after startup become visible. - IconUtils::tryUpdateIconCache(); QStringList readyItems; for (auto it = m_pendingAppItems.begin(); it != m_pendingAppItems.end();) { - const QString &iconName = it.value(); - const bool ready = QFileInfo(iconName).isAbsolute() - ? QFileInfo::exists(iconName) - : !QIcon::fromTheme(iconName).isNull(); - if (ready) { + if (QFileInfo::exists(it.value())) { readyItems.append(it.key()); it = m_pendingAppItems.erase(it); } else { @@ -285,8 +271,7 @@ void AppMgr::checkPendingAppItems() } } - // 120s timeout (3s interval): cover slow theme initialization. - if (m_checkCount >= 40) { + if (m_checkCount >= 20) { readyItems.append(m_pendingAppItems.keys()); m_pendingAppItems.clear(); }