From a0ca936e8d42daf49111a59d2482b53ae16001c9 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 19 Nov 2021 23:22:39 +0100 Subject: [PATCH] sizerequestcache: Increase size This is a quickfix to avoid infinite runtime in nested boxes with wrapped labels. Test included --- gtk/gtksizerequestcacheprivate.h | 6 +- testsuite/reftests/meson.build | 2 + .../wrapping-in-boxes-in-boxes.ref.ui | 22 +++++++ .../reftests/wrapping-in-boxes-in-boxes.ui | 58 +++++++++++++++++++ 4 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 testsuite/reftests/wrapping-in-boxes-in-boxes.ref.ui create mode 100644 testsuite/reftests/wrapping-in-boxes-in-boxes.ui diff --git a/gtk/gtksizerequestcacheprivate.h b/gtk/gtksizerequestcacheprivate.h index 5d460ed013..8b3a3b7240 100644 --- a/gtk/gtksizerequestcacheprivate.h +++ b/gtk/gtksizerequestcacheprivate.h @@ -36,7 +36,7 @@ G_BEGIN_DECLS * only wrap to 3 lines, only 3 caches will * ever be allocated for it. */ -#define GTK_SIZE_REQUEST_CACHED_SIZES (5) +#define GTK_SIZE_REQUEST_CACHED_SIZES (64) typedef struct { int minimum_size; @@ -74,8 +74,8 @@ typedef struct { GtkSizeRequestMode request_mode : 3; guint request_mode_valid : 1; struct { - guint n_cached_requests : 3; - guint last_cached_request : 3; + guint n_cached_requests : 15; + guint last_cached_request : 15; guint cached_size_valid : 1; } flags[2]; } SizeRequestCache; diff --git a/testsuite/reftests/meson.build b/testsuite/reftests/meson.build index 01f813bee5..1df038aa22 100644 --- a/testsuite/reftests/meson.build +++ b/testsuite/reftests/meson.build @@ -529,6 +529,8 @@ testdata = [ #'window-show-contents-on-map.ui', 'wrap-margin-align-critical.ref.ui', 'wrap-margin-align-critical.ui', + 'wrapping-in-boxes-in-boxes.ref.ui', + 'wrapping-in-boxes-in-boxes.ui', ] # These need to be fixed but the issue hasn't been tracked down. diff --git a/testsuite/reftests/wrapping-in-boxes-in-boxes.ref.ui b/testsuite/reftests/wrapping-in-boxes-in-boxes.ref.ui new file mode 100644 index 0000000000..db2293bd30 --- /dev/null +++ b/testsuite/reftests/wrapping-in-boxes-in-boxes.ref.ui @@ -0,0 +1,22 @@ + + + + 0 + + + + + vertical + + + Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum + 1 + 60 + + + + + + + + diff --git a/testsuite/reftests/wrapping-in-boxes-in-boxes.ui b/testsuite/reftests/wrapping-in-boxes-in-boxes.ui new file mode 100644 index 0000000000..6de4a24ef4 --- /dev/null +++ b/testsuite/reftests/wrapping-in-boxes-in-boxes.ui @@ -0,0 +1,58 @@ + + + + 0 + + + + + vertical + + + + + vertical + + + + + vertical + + + + + vertical + + + + + vertical + + + Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum + 1 + 60 + + + + + + + + + + + + + + + + + + + + + + + +