From b49d5cfde0986da19e89ad5f0c58b76d19acceef Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sun, 29 Dec 2019 21:13:32 +0100 Subject: [PATCH] Only serialize window pixmap if we're using it The previous QIcon::name() check wasn't sufficient as it only works with theme icon names (e.g. kate) but not icons created from an absolute path, e.g. /some/special/icon/location/kate.png. The latter is usually the case for containerized apps which have a proper application desktop file installed but their icon in some path within the application image or some container daemon location. Since we already store the information for whether we had to fall back to using the actual window pixmap, check for this before trying to serialize icon pixmap data. Differential Revision: https://phabricator.kde.org/D25762 --- libtaskmanager/xwindowtasksmodel.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libtaskmanager/xwindowtasksmodel.cpp b/libtaskmanager/xwindowtasksmodel.cpp index 59638a8f5..26533aa4c 100644 --- a/libtaskmanager/xwindowtasksmodel.cpp +++ b/libtaskmanager/xwindowtasksmodel.cpp @@ -535,17 +535,25 @@ QUrl XWindowTasksModel::Private::launcherUrl(WId window, bool encodeFallbackIcon { const AppData &data = appData(window); - if (!encodeFallbackIcon || !data.icon.name().isEmpty()) { - return data.url; - } QUrl url = data.url; + if (!encodeFallbackIcon || !data.icon.name().isEmpty()) { + return url; + } // Forego adding the window icon pixmap if the URL is otherwise empty. if (!url.isValid()) { return QUrl(); } + // Only serialize pixmap data if the window pixmap is actually being used. + // QIcon::name() used above only returns a themed icon name but nothing when + // the icon was created using an absolute path, as can be the case with, e.g. + // containerized apps. + if (!usingFallbackIcon.contains(window)) { + return url; + } + const QPixmap pixmap = KWindowSystem::icon(window, KIconLoader::SizeLarge, KIconLoader::SizeLarge, false); if (pixmap.isNull()) { return data.url;