diamondburned / gotktrix

Matrix client in Go and GTK4
GNU Affero General Public License v3.0
313 stars 7 forks source link

Crashes on GTK 4.6.x #33

Closed diamondburned closed 2 years ago

diamondburned commented 2 years ago

I have no idea why.

Known:

Possible ways to debug:


gdb backtrace ``` #0 g_logv (log_domain=0x7ffff7a6d355 "Gtk", log_level=G_LOG_LEVEL_CRITICAL, format=, args=) at ../glib/gmessages.c:1418 #1 0x00007ffff7e5082f in g_log (log_domain=log_domain@entry=0x7ffff7a6d355 "Gtk", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7ffff7ea8dbd "%s: assertion '%s' failed") at ../glib/gmessages.c:1456 #2 0x00007ffff7e510c9 in g_return_if_fail_warning (log_domain=log_domain@entry=0x7ffff7a6d355 "Gtk", pretty_function=pretty_function@entry=0x7ffff7ab7790 <__func__.3> "gtk_widget_measure", expression=) at ../glib/gmessages.c:2942 #3 0x00007ffff7814f6b in gtk_widget_measure (widget=, orientation=orientation@entry=GTK_ORIENTATION_HORIZONTAL, for_size=for_size@entry=-1677721602, minimum=minimum@entry=0x7fffc7ffc8f8, natural=natural@entry=0x7fffc7ffc8fc, minimum_baseline=minimum_baseline@entry=0x0, natural_baseline=0x0) at ../gtk/gtksizerequest.c:486 #4 0x00007ffff76d0ccb in distribute_remaining_size (max=, min=1308622847, available=31, orientation=GTK_ORIENTATION_HORIZONTAL, n_sizes=, sizes=) at ../gtk/gtkboxlayout.c:332 #5 gtk_box_layout_compute_opposite_size_for_size (self=, widget=0x7fffc1c8a690, for_size=, minimum=0x7fffc7ffca18, natural=0x7fffc7ffca1c, min_baseline=0x7fffc7ffca20, nat_baseline=0x7fffc7ffca24) at ../gtk/gtkboxlayout.c:463 #6 0x00007ffff778af23 in gtk_layout_manager_measure (manager=0x7fffc1c8d820, widget=widget@entry=0x7fffc1c8a690, orientation=orientation@entry=GTK_ORIENTATION_VERTICAL, for_size=75, minimum=minimum@entry=0x7fffc7ffcb28, natural=natural@entry=0x7fffc7ffcb2c, minimum_baseline=0x7fffc7ffcb20, natural_baseline=0x7fffc7ffcb24) at ../gtk/gtklayoutmanager.c:341 #7 0x00007ffff7815c0a in gtk_widget_query_size_for_orientation (widget=widget@entry=0x7fffc1c8a690, orientation=orientation@entry=GTK_ORIENTATION_VERTICAL, for_size=85, minimum=minimum@entry=0x7fffc7ffcba8, natural=natural@entry=0x7fffc7ffcbac, minimum_baseline=minimum_baseline@entry=0x7fffc7ffcbb0, natural_baseline=0x7fffc7ffcbb4) at ../gtk/gtksizerequest.c:248 #8 0x00007ffff78150d8 in gtk_widget_measure (widget=widget@entry=0x7fffc1c8a690, orientation=orientation@entry=GTK_ORIENTATION_VERTICAL, for_size=, for_size@entry=85, minimum=minimum@entry=0x7fffc7ffcba8, natural=natural@entry=0x7fffc7ffcbac, minimum_baseline=minimum_baseline@entry=0x7fffc7ffcbb0, natural_baseline=) at ../gtk/gtksizerequest.c:518 #9 0x00007ffff76b03e0 in gtk_bin_layout_measure (layout_manager=, widget=, orientation=GTK_ORIENTATION_VERTICAL, for_size=85, minimum=0x7fffc7ffcc28, natural=0x7fffc7ffcc2c, minimum_baseline=0x7fffc7ffcc30, natural_baseline=0x7fffc7ffcc34) at ../gtk/gtkbinlayout.c:66 #10 0x00007ffff778af23 in gtk_layout_manager_measure (manager=0x7fffc1c83c60, widget=widget@entry=0x7fffc1c51360, orientation=orientation@entry=GTK_ORIENTATION_VERTICAL, for_size=85, minimum=minimum@entry=0x7fffc7ffcd38, natural=natural@entry=0x7fffc7ffcd3c, minimum_baseline=0x7fffc7ffcd30, natural_baseline=0x7fffc7ffcd34) at ../gtk/gtklayoutmanager.c:341 #11 0x00007ffff7815c0a in gtk_widget_query_size_for_orientation (widget=widget@entry=0x7fffc1c51360, orientation=orientation@entry=GTK_ORIENTATION_VERTICAL, for_size=85, minimum=minimum@entry=0x7fffc7ffcdb4, natural=natural@entry=0x0, minimum_baseline=minimum_baseline@entry=0x0, natural_baseline=0x0) at ../gtk/gtksizerequest.c:248 #12 0x00007ffff78150d8 in gtk_widget_measure (widget=widget@entry=0x7fffc1c51360, orientation=orientation@entry=GTK_ORIENTATION_VERTICAL, for_size=, minimum=minimum@entry=0x7fffc7ffcdb4, natural=natural@entry=0x0, minimum_baseline=minimum_baseline@entry=0x0, natural_baseline=) at ../gtk/gtksizerequest.c:518 #13 0x00007ffff7792515 in gtk_list_box_measure (widget=, orientation=GTK_ORIENTATION_VERTICAL, for_size=, minimum=0x7fffc7ffceb8, natural=0x7fffc7ffcebc, minimum_baseline=, natural_baseline=0x7fffc7ffceb4) at ../gtk/gtklistbox.c:2551 #14 0x00007ffff781682e in gtk_widget_query_size_for_orientation (widget=0x7fffc01531a0, orientation=orientation@entry=GTK_ORIENTATION_VERTICAL, for_size=85, minimum=minimum@entry=0x7fffc7ffcf38, natural=natural@entry=0x7fffc7ffcf3c, minimum_baseline=minimum_baseline@entry=0x0, natural_baseline=0x0) at ../gtk/gtksizerequest.c:289 #15 0x00007ffff78150d8 in gtk_widget_measure (widget=, orientation=orientation@entry=GTK_ORIENTATION_VERTICAL, for_size=, for_size@entry=85, minimum=minimum@entry=0x7fffc7ffcf38, natural=natural@entry=0x7fffc7ffcf3c, minimum_baseline=minimum_baseline@entry=0x0, natural_baseline=) at ../gtk/gtksizerequest.c:518 #16 0x00007ffff76d0c2b in distribute_remaining_size (max=2147483647, min=85, available=421, orientation=GTK_ORIENTATION_VERTICAL, n_sizes=1, sizes=) at ../gtk/gtkboxlayout.c:307 #17 gtk_box_layout_compute_opposite_size_for_size (self=0x7fffc162b4c0, widget=0x7fffc198c650, for_size=, minimum=0x7fffc7ffd058, natural=0x7fffc7ffd05c, min_baseline=0x7fffc7ffd060, nat_baseline=0x7fffc7ffd064) at ../gtk/gtkboxlayout.c:463 #18 0x00007ffff778af23 in gtk_layout_manager_measure (manager=0x7fffc162b4c0, widget=widget@entry=0x7fffc198c650, orientation=orientation@entry=GTK_ORIENTATION_HORIZONTAL, for_size=507, minimum=minimum@entry=0x7fffc7ffd168, natural=natural@entry=0x7fffc7ffd16c, minimum_baseline=0x7fffc7ffd160, natural_baseline=0x7fffc7ffd164) at ../gtk/gtklayoutmanager.c:341 #19 0x00007ffff7815c0a in gtk_widget_query_size_for_orientation (widget=widget@entry=0x7fffc198c650, orientation=orientation@entry=GTK_ORIENTATION_HORIZONTAL, for_size=507, minimum=0x7fffc7ffd230, natural=natural@entry=0x0, minimum_baseline=minimum_baseline@entry=0x0, natural_baseline=0x0) at ../gtk/gtksizerequest.c:248 #20 0x00007ffff78150d8 in gtk_widget_measure (widget=widget@entry=0x7fffc198c650, orientation=orientation@entry=GTK_ORIENTATION_HORIZONTAL, for_size=, for_size@entry=507, minimum=, natural=natural@entry=0x0, minimum_baseline=minimum_baseline@entry=0x0, natural_baseline=) at ../gtk/gtksizerequest.c:518 #21 0x00007ffff78bcc2e in gtk_widget_allocate (widget=0x7fffc198c650, width=450, height=507, baseline=baseline@entry=-1, transform=0x0) at ../gtk/gtkwidget.c:3963 #22 0x00007ffff78bd708 in gtk_widget_size_allocate (widget=, allocation=allocation@entry=0x7fffc7ffd2b0, baseline=baseline@entry=-1) at ../gtk/gtkwidget.c:3777 #23 0x00007ffff78adeff in gtk_viewport_size_allocate (widget=0x7fffc1960800, width=, height=507, baseline=) at ../gtk/gtkviewport.c:547 #24 0x00007ffff78bd450 in gtk_widget_allocate (widget=0x7fffc1960800, width=, height=, baseline=baseline@entry=-1, transform=) at ../gtk/gtkwidget.c:4078 #25 0x00007ffff78bd708 in gtk_widget_size_allocate (widget=, allocation=allocation@entry=0x7fffc7ffd3e0, baseline=baseline@entry=-1) at ../gtk/gtkwidget.c:3777 #26 0x00007ffff77faef1 in gtk_scrolled_window_allocate_child (swindow=swindow@entry=0x7fffc00f3260, width=width@entry=450, height=height@entry=507) at ../gtk/gtkscrolledwindow.c:3132 #27 0x00007ffff77fb3b7 in gtk_scrolled_window_size_allocate (widget=0x7fffc00f3260, width=450, height=507, baseline=) at ../gtk/gtkscrolledwindow.c:1701 #28 0x00007ffff78bd450 in gtk_widget_allocate (widget=widget@entry=0x7fffc00f3260, width=, height=, baseline=baseline@entry=-1, transform=) at ../gtk/gtkwidget.c:4078 #29 0x00007ffff78bd708 in gtk_widget_size_allocate (widget=widget@entry=0x7fffc00f3260, allocation=allocation@entry=0x7fffc7ffd5b0, baseline=baseline@entry=-1) at ../gtk/gtkwidget.c:3777 #30 0x00007ffff77c348c in gtk_overlay_layout_allocate (layout_manager=0x7fffc1c548a0, widget=0x7fffc1c36db0, width=450, height=507, baseline=) at ../gtk/gtkoverlaylayout.c:423 #31 0x00007ffff78bd224 in gtk_widget_allocate (widget=widget@entry=0x7fffc1c36db0, width=, height=, baseline=baseline@entry=-1, transform=) at ../gtk/gtkwidget.c:4071 #32 0x00007ffff78bd708 in gtk_widget_size_allocate (widget=widget@entry=0x7fffc1c36db0, allocation=allocation@entry=0x7fffc7ffd770, baseline=baseline@entry=-1) at ../gtk/gtkwidget.c:3777 #33 0x00007ffff76d0331 in gtk_box_layout_allocate (layout_manager=0x7fffc134d820, widget=, width=, height=, baseline=-1) at ../gtk/gtkboxlayout.c:835 #34 0x00007ffff78bd224 in gtk_widget_allocate (widget=widget@entry=0x7fffc1c36f40, width=width@entry=450, height=height@entry=554, baseline=baseline@entry=-1, transform=, transform@entry=0x0) at ../gtk/gtkwidget.c:4071 #35 0x00007ffff76b02f7 in gtk_bin_layout_allocate (layout_manager=, widget=, width=450, height=554, baseline=-1) at ../gtk/gtkbinlayout.c:95 #36 0x00007ffff78bd224 in gtk_widget_allocate (widget=0x7fffc1c58620, width=, height=, baseline=baseline@entry=-1, transform=) at ../gtk/gtkwidget.c:4071 #37 0x00007ffff78bd708 in gtk_widget_size_allocate (widget=, allocation=allocation@entry=0x7fffc7ffd9a0, baseline=baseline@entry=-1) at ../gtk/gtkwidget.c:3777 #38 0x00007ffff78244bd in gtk_stack_size_allocate (widget=0x7fffc1c5f1d0, width=, height=, baseline=) at ../gtk/gtkstack.c:2546 #39 0x00007ffff78bd450 in gtk_widget_allocate (widget=0x7fffc1c5f1d0, width=, height=, baseline=baseline@entry=-1, transform=) at ../gtk/gtkwidget.c:4078 #40 0x00007ffff78bd708 in gtk_widget_size_allocate (widget=, allocation=allocation@entry=0x7fffc7ffdae0, baseline=baseline@entry=-1) at ../gtk/gtkwidget.c:3777 #41 0x00007ffff78244bd in gtk_stack_size_allocate (widget=0x7fffc13aa3f0, width=, height=, baseline=) at ../gtk/gtkstack.c:2546 --Type for more, q to quit, c to continue without paging--c #42 0x00007ffff78bd450 in gtk_widget_allocate (widget=widget@entry=0x7fffc13aa3f0, width=, height=, baseline=baseline@entry=-1, transform=) at ../gtk/gtkwidget.c:4078 #43 0x00007ffff78bd708 in gtk_widget_size_allocate (widget=widget@entry=0x7fffc13aa3f0, allocation=allocation@entry=0x7fffc7ffdc50, baseline=baseline@entry=-1) at ../gtk/gtkwidget.c:3777 #44 0x00007ffff77c348c in gtk_overlay_layout_allocate (layout_manager=0x7fffc1966660, widget=0x7fffc1968180, width=450, height=554, baseline=) at ../gtk/gtkoverlaylayout.c:423 #45 0x00007ffff78bd224 in gtk_widget_allocate (widget=widget@entry=0x7fffc1968180, width=, height=, baseline=baseline@entry=-1, transform=) at ../gtk/gtkwidget.c:4071 #46 0x00007ffff78bd708 in gtk_widget_size_allocate (widget=widget@entry=0x7fffc1968180, allocation=allocation@entry=0x7fffc7ffde10, baseline=baseline@entry=-1) at ../gtk/gtkwidget.c:3777 #47 0x00007ffff76d0331 in gtk_box_layout_allocate (layout_manager=0x7fffc19626a0, widget=, width=, height=, baseline=-1) at ../gtk/gtkboxlayout.c:835 #48 0x00007ffff78bd224 in gtk_widget_allocate (widget=widget@entry=0x7fffc1968310, width=, height=, baseline=baseline@entry=-1, transform=) at ../gtk/gtkwidget.c:4071 #49 0x00007ffff78bd708 in gtk_widget_size_allocate (widget=widget@entry=0x7fffc1968310, allocation=allocation@entry=0x7fffc7ffdf80, baseline=baseline@entry=-1) at ../gtk/gtkwidget.c:3777 #50 0x00007ffff77c348c in gtk_overlay_layout_allocate (layout_manager=0x7fffc19666a0, widget=0x7fffc1968480, width=700, height=554, baseline=) at ../gtk/gtkoverlaylayout.c:423 #51 0x00007ffff78bd224 in gtk_widget_allocate (widget=widget@entry=0x7fffc1968480, width=, height=, baseline=baseline@entry=-1, transform=) at ../gtk/gtkwidget.c:4071 #52 0x00007ffff78bd708 in gtk_widget_size_allocate (widget=widget@entry=0x7fffc1968480, allocation=allocation@entry=0x7fffc7ffe0a0, baseline=baseline@entry=-1) at ../gtk/gtkwidget.c:3777 #53 0x00007ffff78ccd18 in gtk_window_size_allocate (widget=0x7fffc0130330, width=, height=, baseline=) at ../gtk/gtkwindow.c:4613 #54 0x00007ffff78bd450 in gtk_widget_allocate (widget=widget@entry=0x7fffc0130330, width=, height=, baseline=baseline@entry=-1, transform=, transform@entry=0x0) at ../gtk/gtkwidget.c:4078 #55 0x00007ffff78c83d9 in gtk_window_native_layout (native=0x7fffc0130330, width=, height=) at ../gtk/gtkwindow.c:2140 #56 0x00007ffff77f16cb in gtk_native_layout (height=694, width=794, self=0x7fffc0130330) at ../gtk/gtknative.c:112 #57 surface_layout_cb (surface=, width=794, height=694, native=0x7fffc0130330) at ../gtk/gtknative.c:121 #58 0x00007ffff79ade68 in _gdk_marshal_VOID__INT_INTv (closure=closure@entry=0x7fffc10421c0, return_value=return_value@entry=0x0, instance=instance@entry=0x7fffc0172120, args=args@entry=0x7fffc7ffe430, marshal_data=marshal_data@entry=0x0, n_params=n_params@entry=2, param_types=0x7fffc016a080) at gdk/gdkmarshalers.c:479 #59 0x00007ffff7f42849 in _g_closure_invoke_va (closure=closure@entry=0x7fffc10421c0, return_value=return_value@entry=0x0, instance=instance@entry=0x7fffc0172120, args=args@entry=0x7fffc7ffe430, n_params=2, param_types=0x7fffc016a080) at ../gobject/gclosure.c:893 #60 0x00007ffff7f5af1b in g_signal_emit_valist (instance=0x7fffc0172120, signal_id=166, detail=0, var_args=var_args@entry=0x7fffc7ffe430) at ../gobject/gsignal.c:3406 #61 0x00007ffff7f5b1af in g_signal_emit (instance=, signal_id=, detail=) at ../gobject/gsignal.c:3553 #62 0x00007ffff7f4261f in g_closure_invoke (closure=0x7fffc0170eb0, return_value=return_value@entry=0x0, n_param_values=1, param_values=param_values@entry=0x7fffc7ffe6a0, invocation_hint=invocation_hint@entry=0x7fffc7ffe620) at ../gobject/gclosure.c:830 #63 0x00007ffff7f5456b in signal_emit_unlocked_R (node=node@entry=0x7fffc016e2b0, detail=detail@entry=0, instance=instance@entry=0x7fffc016f190, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffc7ffe6a0) at ../gobject/gsignal.c:3743 #64 0x00007ffff7f5ac4f in g_signal_emit_valist (instance=, signal_id=, detail=, var_args=var_args@entry=0x7fffc7ffe820) at ../gobject/gsignal.c:3496 #65 0x00007ffff7f5b1af in g_signal_emit (instance=instance@entry=0x7fffc016f190, signal_id=, detail=detail@entry=0) at ../gobject/gsignal.c:3553 #66 0x00007ffff79c765f in _gdk_frame_clock_emit_layout (frame_clock=frame_clock@entry=0x7fffc016f190) at ../gdk/gdkframeclock.c:696 #67 0x00007ffff79c800e in gdk_frame_clock_paint_idle (data=0x7fffc016f190, data@entry=) at ../gdk/gdkframeclockidle.c:582 #68 0x00007ffff7e498b4 in g_timeout_dispatch (source=0x7fffc19c0ec0, callback=, user_data=) at ../glib/gmain.c:4971 #69 0x00007ffff7e48d3f in g_main_dispatch (context=0x3acdaa0) at ../glib/gmain.c:3417 #70 g_main_context_dispatch (context=0x3acdaa0) at ../glib/gmain.c:4135 #71 0x00007ffff7e490e8 in g_main_context_iterate (context=context@entry=0x3acdaa0, block=block@entry=1, dispatch=dispatch@entry=1, self=) at ../glib/gmain.c:4211 #72 0x00007ffff7e4919f in g_main_context_iteration (context=context@entry=0x3acdaa0, may_block=may_block@entry=1) at ../glib/gmain.c:4276 #73 0x00007ffff71c0605 in g_application_run (application=0x3ad0290, argc=-939529644, argv=) at ../gio/gapplication.c:2569 ```
daenney commented 2 years ago

GTK 4.6 changed a bunch of things around sizing: https://blog.gtk.org/2021/12/03/sizable-news/. It doesn't feel like that should result in an outright crash though, but maybe it provides a starting point. There's some bits and bobs in the newsfiles too: https://download.gnome.org/sources/gtk/4.6/

diamondburned commented 2 years ago

Ah, this seems helpful. I like the changes, but it seems like they don't like some of the sizing hacks that I put in place.

diamondburned commented 2 years ago

I've managed to get a stack trace of the widget that's causing the bug:

0x7ff009f32990: goroutine 1 [running, locked to thread]:
runtime/debug.Stack()
    /nix/store/89l684ydhgb4da9qqvbd2v2367sf1s2f-go-1.18/share/go/src/runtime/debug/stack.go:24 +0x65
github.com/diamondburned/gotk4/pkg/core/intern.newBox(0x7ff009f32990)
    /home/diamond/Scripts/gotk4/gotk4/pkg/core/intern/intern.go:60 +0x66
github.com/diamondburned/gotk4/pkg/core/intern.Get(0x7ff009f32990, 0x1)
    /home/diamond/Scripts/gotk4/gotk4/pkg/core/intern/intern.go:143 +0x133
github.com/diamondburned/gotk4/pkg/core/glib.newObject(...)
    /home/diamond/Scripts/gotk4/gotk4/pkg/core/glib/glib.go:583
github.com/diamondburned/gotk4/pkg/core/glib.Take(...)
    /home/diamond/Scripts/gotk4/gotk4/pkg/core/glib/glib.go:560
github.com/diamondburned/gotk4/pkg/gtk/v4.NewBox(0x1, 0x0)
    /home/diamond/Scripts/gotk4/gotk4/pkg/gtk/v4/gtkbox.go:138 +0x65
github.com/diamondburned/gotktrix/internal/app/messageview/message.messageViewer.cozyMessage({{0x2112ea0, 0xc000ad7860}, {0x2114658, 0xc0009f5860}, {0x2110fc8, 0xc000fdb2c0}}, 0xc000fdb2c0)
    /home/diamond/Scripts/gotk4/gotktrix/internal/app/messageview/message/cozy.go:70 +0x45e
github.com/diamondburned/gotktrix/internal/app/messageview/message.NewCozyMessage({0x2114658?, 0xc0009f5860?}, {0x2112ea0?, 0xc000ad7860?}, {0x2110fc8?, 0xc000fdb2c0?}, {0x2120848?, 0xc000b0cde0?})
    /home/diamond/Scripts/gotk4/gotktrix/internal/app/messageview/message/message.go:98 +0x12a
github.com/diamondburned/gotktrix/internal/app/messageview.(*Page).resetMessage(0xc000ad7860, {0xc000c7c800, 0x32}, {0xc0008269c0, {0x2110fc8, 0xc000fdb180}, 0x0, {0x2120848, 0xc000b0cde0}, {0xc0007cacc0, ...}})
    /home/diamond/Scripts/gotk4/gotktrix/internal/app/messageview/page.go:786 +0x1c5
github.com/diamondburned/gotktrix/internal/app/messageview.(*Page).resetMessageIx(0xc000ad7860, 0x1d)
    /home/diamond/Scripts/gotk4/gotktrix/internal/app/messageview/page.go:760 +0xf6
github.com/diamondburned/gotktrix/internal/app/messageview.(*Page).setMessage(0xc000ad7860, {0xc000c7c480?, 0x8?}, {0xc000f15c20, {0x2110fc8, 0xc000fdb2c0}, 0x0, {0x0, 0x0}, {0x0, ...}})
    /home/diamond/Scripts/gotk4/gotktrix/internal/app/messageview/page.go:747 +0xe5
github.com/diamondburned/gotktrix/internal/app/messageview.(*Page).onRoomEvent(0xc000ad7860, {0x2110fc8, 0xc000fdb2c0})
    /home/diamond/Scripts/gotk4/gotktrix/internal/app/messageview/page.go:720 +0x2a5
github.com/diamondburned/gotktrix/internal/app/messageview.(*Page).Load.func1.1()
    /home/diamond/Scripts/gotk4/gotktrix/internal/app/messageview/page.go:873 +0xa6
github.com/diamondburned/gotk4/pkg/core/glib._gotk4_sourceFunc(0x1a7b)
    /home/diamond/Scripts/gotk4/gotk4/pkg/core/glib/glib.go:328 +0xd9
github.com/diamondburned/gotk4/pkg/gio/v2._Cfunc_g_application_run(0x5347290, 0x1, 0x7ff008002020)
    _cgo_gotypes.go:5619 +0x4c
github.com/diamondburned/gotk4/pkg/gio/v2.(*Application).Run.func3(0xc000779f80?, 0x8?, 0x7ff008002020?)
    /home/diamond/Scripts/gotk4/gotk4/pkg/gio/v2/gapplication.go:1619 +0x71
github.com/diamondburned/gotk4/pkg/gio/v2.(*Application).Run(0xc0004fe1f8, {0xc0001181f0?, 0x1, 0x1})
    /home/diamond/Scripts/gotk4/gotk4/pkg/gio/v2/gapplication.go:1619 +0x1d8
github.com/diamondburned/gotkit/app.(*Application).Run(0xc0001ea280, {0x2114658, 0xc000693b90}, {0xc0001181f0, 0x1, 0x1})
    /home/diamond/go/pkg/mod/github.com/diamondburned/gotkit@v0.0.0-20220429055254-0e11be4d973f/app/app.go:237 +0x189
github.com/diamondburned/gotkit/app.(*Application).RunMain(0x2118f78?, {0x2114658?, 0xc000693b90?})
    /home/diamond/go/pkg/mod/github.com/diamondburned/gotkit@v0.0.0-20220429055254-0e11be4d973f/app/app.go:242 +0x38
main.main()
    /home/diamond/Scripts/gotk4/gotktrix/main.go:129 +0x189

size-request debug output:

[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 38 is minimum 650 and natural: 650 (hit cache: yes)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 76 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 57 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 47 is minimum 650 and natural: 650 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 52 is minimum 650 and natural: 650 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 55 is minimum 650 and natural: 650 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 56 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox width for height: -1 is minimum 31 and natural: 650 (hit cache: yes)
[0x7ff009f32990] GtkBox height for width: 396 is minimum 56 and natural: 56 (hit cache: no)
[0x7ff009f32990] GtkBox width for height: -1 is minimum 31 and natural: 650 (hit cache: yes)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 38 is minimum 650 and natural: 650 (hit cache: yes)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 76 is minimum 331 and natural: 331 (hit cache: yes)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 154 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 310 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 622 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 1246 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 2494 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 4990 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 9982 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 19966 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 39934 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 79870 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 159742 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 319486 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 638974 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 1277950 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 2555902 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 5111806 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 10223614 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 20447230 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 40894462 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 81788926 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 163577854 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 327155710 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 654311422 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 1308622846 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 939524094 is minimum 331 and natural: 331 (hit cache: yes)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 1879048190 is minimum 331 and natural: 331 (hit cache: no)
[0x7ff009f32990] GtkBox height for width: -1 is minimum 38 and natural: 38 (hit cache: yes)
[0x7ff009f32990] GtkBox width for height: 2147483646 is minimum 331 and natural: 331 (hit cache: no)
diamondburned commented 2 years ago

Seems like it's stuck in this section of code:

  /* total_size > available happens when we last ran for values too big,
   * rerun for the correct value min == max in that case */
  while (min < max || total_size > available)
    {
      int test;

      if (max == G_MAXINT)
        test = min * 2;       // size multiplied by 2 here
      else
        test = (min + max) / 2;

      total_size = 0;
      for (i = 0; i < n_sizes; i++)
        {
          gtk_widget_measure (sizes[i].data,
                              orientation,
                              test,
                              &sizes[i].minimum_size, &sizes[i].natural_size,
                              NULL, NULL);
          total_size += sizes[i].minimum_size;
        }

      if (total_size > available)
        min = test + 1;
      else
        max = test;
    }
diamondburned commented 2 years ago

Inspecting the call to distribute_remaining_size more carefully:

      int min_size = 0, child_min_size;
      int n_inconstant = 0;

      /* Retrieve desired size for visible children */
      for (i = 0, child = _gtk_widget_get_first_child (widget);
           child != NULL;
           child = _gtk_widget_get_next_sibling (child))
        {
          if (!gtk_widget_should_layout (child))
            continue;

          if (gtk_widget_get_request_mode (child) == GTK_SIZE_REQUEST_CONSTANT_SIZE)
            {
              gtk_widget_measure (child,
                                  self->orientation,
                                  -1,
                                  &sizes[i].minimum_size, &sizes[i].natural_size,
                                  NULL, NULL);
              sizes[i].data = child;
              g_assert (available >= sizes[i].minimum_size);
              available -= sizes[i].minimum_size;
              i++;
            }
          else
            {
              gtk_widget_measure (child,
                                  OPPOSITE_ORIENTATION (self->orientation),
                                  -1,
                                  &child_min_size, NULL,
                                  NULL, NULL);
              min_size = MAX (min_size, child_min_size);
              n_inconstant++;
              sizes[nvis_children - n_inconstant].data = child;
            }
        }

      available = distribute_remaining_size (sizes + nvis_children - n_inconstant,
                                             n_inconstant,
                                             self->orientation,
                                             available,
                                             min_size,
                                             G_MAXINT);

along with gdb's output:

#4  0x00007ffff76d0ccb in distribute_remaining_size (max=<optimized out>, min=1308622847, available=31, orientation=GTK_ORIENTATION_HORIZONTAL, n_sizes=<optimized out>, sizes=<optimized out>) at ../gtk/gtkboxlayout.c:332

it can be seen that min_size here is 1308622847, which is a ridiculously large number. This is probably caused by min_size = MAX (min_size, child_min_size), so child_min_size is presumably also that large.

diamondburned commented 2 years ago

Further inspection gives

min_size = <optimized out>
child_min_size = 38

so it actually isn't child_min_size.

diamondburned commented 2 years ago

One thing worth noting is that child_min_size is not initialized to 0. The value may have been some randomly high number.

diamondburned commented 2 years ago

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/4517.

diamondburned commented 2 years ago

MR https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4670 should fix this. It doesn't seem like this is going to make it into a release that's widely available anytime soon, though.

diamondburned commented 2 years ago

Can confirm that above MR fixes this regression. Console outputs

2022/04/30 16:25:10 Critical: Gtk: GtkBox 0x7f19cdf275f0 reports a minimum width of 31, but minimum width for height of 1048576 is 331. Expect overlapping widgets.

yet no overlapping is visible:

image

Closing this issue since it's fixed.