Update to 4.7.0

This commit is contained in:
David King 2022-05-09 08:22:40 +01:00
parent 7bfca4f7f4
commit 6a7b75aec1
4 changed files with 16 additions and 98 deletions

1
.gitignore vendored
View File

@ -30,3 +30,4 @@
/gtk-4.6.1.tar.xz
/gtk-4.6.2.tar.xz
/gtk-4.6.3.tar.xz
/gtk-4.7.0.tar.xz

View File

@ -1,85 +0,0 @@
From 90e372fb8e55fa2176d019dd5875a667ed8d3fbc Mon Sep 17 00:00:00 2001
From: Benjamin Otte <otte@redhat.com>
Date: Tue, 26 Apr 2022 19:51:16 +0200
Subject: [PATCH] boxlayout: Do not infloop
if the loop for determining max width grows too big, print an error and
abort assuming that a satisfactory value was reached.
This will cause wrong layout and might cause widgets to overlap, but it
will not infloop.
---
gtk/gtkboxlayout.c | 43 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 41 insertions(+), 2 deletions(-)
diff --git a/gtk/gtkboxlayout.c b/gtk/gtkboxlayout.c
index e79c5e202a..5d1b63169d 100644
--- a/gtk/gtkboxlayout.c
+++ b/gtk/gtkboxlayout.c
@@ -288,6 +288,12 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self,
*natural = largest_nat;
}
+/* if widgets haven't reached their min opposite size at this
+ * huge value, things went massively wrong and we need to bail to not
+ * cause an infinite loop.
+ */
+#define MAX_ALLOWED_SIZE (1 << 20)
+
static int
distribute_remaining_size (GtkRequestedSize *sizes,
gsize n_sizes,
@@ -321,7 +327,40 @@ distribute_remaining_size (GtkRequestedSize *sizes,
{
int test;
- if (max == G_MAXINT)
+ if (min > MAX_ALLOWED_SIZE)
+ {
+ /* sanity check! */
+ for (i = 0; i < n_sizes; i++)
+ {
+ int check_min, check_nat;
+ gtk_widget_measure (sizes[i].data,
+ orientation,
+ MAX_ALLOWED_SIZE,
+ &sizes[i].minimum_size, &sizes[i].natural_size,
+ NULL, NULL);
+ gtk_widget_measure (sizes[i].data,
+ orientation,
+ -1,
+ &check_min, &check_nat,
+ NULL, NULL);
+ if (check_min < sizes[i].minimum_size)
+ {
+ g_critical ("%s %p reports a minimum %s of %u, but minimum %s for %s of %u is %u. Expect overlapping widgets.",
+ G_OBJECT_TYPE_NAME (sizes[i].data), sizes[i].data,
+ orientation == GTK_ORIENTATION_HORIZONTAL ? "width" : "height",
+ check_min,
+ orientation == GTK_ORIENTATION_HORIZONTAL ? "width" : "height",
+ orientation == GTK_ORIENTATION_HORIZONTAL ? "height" : "width",
+ MAX_ALLOWED_SIZE, sizes[i].minimum_size);
+ sizes[i].minimum_size = check_min;
+ sizes[i].natural_size = check_nat;
+ }
+ total_size += sizes[i].minimum_size;
+ }
+ return MAX (0, available - total_size);
+ }
+
+ if (max == MAX_ALLOWED_SIZE)
test = min * 2;
else
test = (min + max) / 2;
@@ -465,7 +504,7 @@ gtk_box_layout_compute_opposite_size_for_size (GtkBoxLayout *self,
self->orientation,
available,
min_size,
- G_MAXINT);
+ MAX_ALLOWED_SIZE);
/* Bring children up to size first */
available = gtk_distribute_natural_allocation (available, nvis_children, sizes);
--
GitLab

View File

@ -16,19 +16,13 @@
%global __provides_exclude_from ^%{_libdir}/gtk-4.0
Name: gtk4
Version: 4.6.3
Version: 4.7.0
Release: 1%{?dist}
Summary: GTK graphical user interface library
License: LGPLv2+
URL: https://www.gtk.org
Source0: https://download.gnome.org/sources/gtk/4.6/gtk-%{version}.tar.xz
# Fix "gtk_widget_measure: assertion 'for_size >= -1' failed" loop bug
# Patch proposed by Benjamin Otte, no MR yet
# https://bugzilla.redhat.com/show_bug.cgi?id=2071228
# https://gitlab.gnome.org/GNOME/gtk/-/issues/4517
# https://gitlab.gnome.org/GNOME/gtk/-/commit/90e372fb8e55fa2176d019dd5875a667ed8d3fbc
Patch1: 90e372fb8e55fa2176d019dd5875a667ed8d3fbc.patch
Source0: https://download.gnome.org/sources/gtk/4.7/gtk-%{version}.tar.xz
BuildRequires: cups-devel
BuildRequires: desktop-file-utils
@ -212,27 +206,35 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_bindir}/gtk4-demo
%{_bindir}/gtk4-demo-application
%{_bindir}/gtk4-icon-browser
%{_bindir}/gtk4-node-editor
%{_bindir}/gtk4-print-editor
%{_bindir}/gtk4-widget-factory
%{_datadir}/applications/org.gtk.gtk4.NodeEditor.desktop
%{_datadir}/applications/org.gtk.Demo4.desktop
%{_datadir}/applications/org.gtk.IconBrowser4.desktop
%{_datadir}/applications/org.gtk.PrintEditor4.desktop
%{_datadir}/applications/org.gtk.WidgetFactory4.desktop
%{_datadir}/icons/hicolor/*/apps/org.gtk.gtk4.NodeEditor*.svg
%{_datadir}/icons/hicolor/*/apps/org.gtk.Demo4*.svg
%{_datadir}/icons/hicolor/*/apps/org.gtk.IconBrowser4*.svg
%{_datadir}/icons/hicolor/*/apps/org.gtk.PrintEditor4*.svg
%{_datadir}/icons/hicolor/*/apps/org.gtk.WidgetFactory4*.svg
%{_datadir}/glib-2.0/schemas/org.gtk.Demo4.gschema.xml
%{_datadir}/metainfo/org.gtk.Demo4.appdata.xml
%{_datadir}/metainfo/org.gtk.IconBrowser4.appdata.xml
%{_datadir}/metainfo/org.gtk.PrintEditor4.appdata.xml
%{_datadir}/metainfo/org.gtk.WidgetFactory4.appdata.xml
%{_metainfodir}/org.gtk.gtk4.NodeEditor.appdata.xml
%{_metainfodir}/org.gtk.Demo4.appdata.xml
%{_metainfodir}/org.gtk.IconBrowser4.appdata.xml
%{_metainfodir}/org.gtk.PrintEditor4.appdata.xml
%{_metainfodir}/org.gtk.WidgetFactory4.appdata.xml
%{_mandir}/man1/gtk4-demo.1*
%{_mandir}/man1/gtk4-demo-application.1*
%{_mandir}/man1/gtk4-icon-browser.1*
%{_mandir}/man1/gtk4-node-editor.1*
%{_mandir}/man1/gtk4-widget-factory.1*
%changelog
* Mon May 09 2022 David King <amigadave@amigadave.com> - 4.7.0-1
- Update to 4.7.0
* Thu Apr 28 2022 David King <amigadave@amigadave.com> - 4.6.3-1
- Update to 4.6.3

View File

@ -1 +1 @@
SHA512 (gtk-4.6.3.tar.xz) = 0e96b39a8171ccefc24808d1af8af8e3cbcc9b403c1bdfd85778ed2e824c93e3687b7baa1237b05fa35181d300eacfd6cc9f79c7a6eef70b365991f0a2769f71
SHA512 (gtk-4.7.0.tar.xz) = ba7cae70c06f6d89e8c320b4cecff231afb01bd1898b57e12d55e5290122536e823b11861d30d46caf770ee0714d2f49af53a25bb2f1134bfca627a590d6f02e