diff --git a/debian/changelog b/debian/changelog index 8e8bca4..a43d24c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ qt6-base (6.6.2+dfsg-11) UNRELEASED; urgency=medium [ Dmitry Shachnev ] * Add a patch to use _Float16 only when SSE2 is enabled (closes: #1076986). + * Backport upstream patch to fix QGtk3Interface::fileIcon with GLib ≥ 2.76. -- Debian Qt/KDE Maintainers Thu, 01 Aug 2024 23:45:39 +0300 diff --git a/debian/patches/fix_qgtk3interface_fileicon.patch b/debian/patches/fix_qgtk3interface_fileicon.patch new file mode 100644 index 0000000..46ab3da --- /dev/null +++ b/debian/patches/fix_qgtk3interface_fileicon.patch @@ -0,0 +1,72 @@ +Description: QGtk3Theme: fix QGtk3Interface::fileIcon + By failing to set the G_FILE_ATTRIBUTE_STANDARD_ICON attribute, the + "icon" returned by g_file_info_get_icon was always null and a + GLib-GIO-CRITICAL warning was output to the console (at least since glib + 2.76.0)[1]. + . + After adding the necessary attribute, the code was crashing, because now + a valid icon was returned, however the icon should not be freed[2], + which is why I removed the "g_object_unref(icon)". + . + Now it was no longer crashing, but the size of the icons was off. It was + passing GTK_ICON_SIZE_BUTTON (4) to gtk_icon_theme_lookup_by_gicon where + a size in pixels was expected. I chose 16 because that's the pixel size + associated with GTK_ICON_SIZE_BUTTON[3]. + . + Finally I noticed the returned icons had the wrong color. It seems that + a GdkPixbuf uses RGBA8888 format[4]. Adding an explicit conversion to + ARGB32 made the icons look correct for me. + . + [1] https://gitlab.gnome.org/GNOME/glib/-/commit/ed8e86a7d41a0900d8fa57edc64264d04cf8135b + [2] https://docs.gtk.org/gio/method.FileInfo.get_icon.html + [3] https://docs.gtk.org/gtk3/enum.IconSize.html#button + [4] https://docs.gtk.org/gdk-pixbuf/class.Pixbuf.html#image-data +Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=277d77029d7fe8f4 +Last-Update: 2024-08-02 + +--- a/src/plugins/platformthemes/gtk3/qgtk3interface.cpp ++++ b/src/plugins/platformthemes/gtk3/qgtk3interface.cpp +@@ -296,8 +296,10 @@ QImage QGtk3Interface::qt_convert_gdk_pi + const int width = gdk_pixbuf_get_width(buf); + const int height = gdk_pixbuf_get_height(buf); + const int bpl = gdk_pixbuf_get_rowstride(buf); +- QImage converted(data, width, height, bpl, QImage::Format_ARGB32); +- return converted.copy(); // detatch to survive lifetime of buf ++ QImage converted(data, width, height, bpl, QImage::Format_RGBA8888); ++ ++ // convert to more optimal format and detach to survive lifetime of buf ++ return converted.convertToFormat(QImage::Format_ARGB32_Premultiplied); + } + + /*! +@@ -666,7 +668,7 @@ QIcon QGtk3Interface::fileIcon(const QFi + if (!file) + return QIcon(); + +- GFileInfo *info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, ++ GFileInfo *info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_ICON, + G_FILE_QUERY_INFO_NONE, nullptr, nullptr); + if (!info) { + g_object_unref(file); +@@ -681,12 +683,11 @@ QIcon QGtk3Interface::fileIcon(const QFi + } + + GtkIconTheme *theme = gtk_icon_theme_get_default(); +- GtkIconInfo *iconInfo = gtk_icon_theme_lookup_by_gicon(theme, icon, GTK_ICON_SIZE_BUTTON, ++ GtkIconInfo *iconInfo = gtk_icon_theme_lookup_by_gicon(theme, icon, 16, + GTK_ICON_LOOKUP_FORCE_SIZE); + if (!iconInfo) { + g_object_unref(file); + g_object_unref(info); +- g_object_unref(icon); + return QIcon(); + } + +@@ -694,7 +695,6 @@ QIcon QGtk3Interface::fileIcon(const QFi + QImage image = qt_convert_gdk_pixbuf(buf); + g_object_unref(file); + g_object_unref(info); +- g_object_unref(icon); + g_object_unref(buf); + return QIcon(QPixmap::fromImage(image)); + } diff --git a/debian/patches/series b/debian/patches/series index 2202b39..08c3e0b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,6 @@ +# fixed in 6.6.3 +fix_qgtk3interface_fileicon.patch +# fixed in 6.7.2 upstream_Prefer-using-the-non-suffixed-libzstd-over-static-on.patch upstream_Ensure-that-libzstd-targets-are-promoted-to-global-i.patch # fixed in 6.9.0