From 4bace05936e2ee9dd7e581603d04c1983cab9fc2 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sun, 30 Jun 2019 14:11:39 +0200 Subject: [PATCH] gtk3: fix g_content_type_is_a() errors --- ...handle-g_content_type_from_mime_type.patch | 35 +++++++++++++++++++ mingw-w64-gtk3/PKGBUILD | 9 +++-- 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 mingw-w64-gtk3/0003-gtkrecentfilter-handle-g_content_type_from_mime_type.patch diff --git a/mingw-w64-gtk3/0003-gtkrecentfilter-handle-g_content_type_from_mime_type.patch b/mingw-w64-gtk3/0003-gtkrecentfilter-handle-g_content_type_from_mime_type.patch new file mode 100644 index 0000000000..884ed099a2 --- /dev/null +++ b/mingw-w64-gtk3/0003-gtkrecentfilter-handle-g_content_type_from_mime_type.patch @@ -0,0 +1,35 @@ +From 8a53ed9e55dac8f559fa47f999e527640889659c Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Sun, 30 Jun 2019 13:59:13 +0200 +Subject: [PATCH] gtkrecentfilter: handle g_content_type_from_mime_type() + returning NULL + +Otherwise we get errors on g_content_type_is_a(). This happens mostly on Windows +because it only knows a limited set of mime types and tries to convert +them to file extensions without any fallback. +--- + gtk/gtkrecentfilter.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/gtk/gtkrecentfilter.c b/gtk/gtkrecentfilter.c +index 4062db59d9..70c021abda 100644 +--- a/gtk/gtkrecentfilter.c ++++ b/gtk/gtkrecentfilter.c +@@ -746,11 +746,12 @@ gtk_recent_filter_filter (GtkRecentFilter *filter, + if (filter_info->mime_type != NULL) + { + gchar *filter_content_type, *rule_content_type; +- gboolean match; ++ gboolean match = FALSE; + + filter_content_type = g_content_type_from_mime_type (filter_info->mime_type); + rule_content_type = g_content_type_from_mime_type (rule->u.mime_type); +- match = g_content_type_is_a (filter_content_type, rule_content_type); ++ if (filter_content_type != NULL && rule_content_type != NULL) ++ match = g_content_type_is_a (filter_content_type, rule_content_type); + g_free (filter_content_type); + g_free (rule_content_type); + +-- +2.22.0 + diff --git a/mingw-w64-gtk3/PKGBUILD b/mingw-w64-gtk3/PKGBUILD index 30ef3c31a8..982ee270a2 100644 --- a/mingw-w64-gtk3/PKGBUILD +++ b/mingw-w64-gtk3/PKGBUILD @@ -4,7 +4,7 @@ _realname=gtk3 pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" pkgver=3.24.9 -pkgrel=3 +pkgrel=4 pkgdesc="GObject-based multi-platform GUI toolkit (v3) (mingw-w64)" arch=('any') url="https://www.gtk.org/" @@ -30,10 +30,12 @@ depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" options=('strip' '!debug' 'staticlibs') source=("https://download.gnome.org/sources/gtk+/${pkgver%.*}/gtk+-${pkgver}.tar.xz" "0001-gtkwindow-Don-t-force-enable-CSD-under-Windows.patch" - "0002-geninclude-missing-encoding.patch") + "0002-geninclude-missing-encoding.patch" + "0003-gtkrecentfilter-handle-g_content_type_from_mime_type.patch") sha256sums=('577eb0270d9adf2eb2aa4b03f9c7873fadb20cf265194d0139570f738493e635' 'f6f8019e21b2932ee2cfb3b261d57b79f6492d4f0a61f9fbf5b8edd193758d9a' - 'af90a58f6e4d281ab6130e6d7e4c5dd43fb6c391d43b210e9b0a3b734ad64746') + 'af90a58f6e4d281ab6130e6d7e4c5dd43fb6c391d43b210e9b0a3b734ad64746' + '401b6a1ee14b1168e5c711b92068c8bc4beb6da392f53d95cd98721434335a53') prepare() { cd "${srcdir}/gtk+-${pkgver}" @@ -42,6 +44,7 @@ prepare() { patch -p1 -i "${srcdir}"/0001-gtkwindow-Don-t-force-enable-CSD-under-Windows.patch patch -p1 -i "${srcdir}"/0002-geninclude-missing-encoding.patch + patch -p1 -i "${srcdir}"/0003-gtkrecentfilter-handle-g_content_type_from_mime_type.patch } build() {