Gtk-CRITICAL **: 01:03:06.215: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton
We merged !438 (merged) despite some weird CRITICALs, because they seem to be a bug in GTK. I am opening this report to not forget about it, and follow up on this issue later on (probably also creating a report to the GTK project).
See the discussion: !438 (comment 1121948)
reproduction steps:
- Create an image with at least 2 layers.
- Export as .webp.
- When the webp option dialog is out, "Save animation" is unchecked (unless previous run had it checked, in which case, reset to factory, export to get new defaults and run the export dialog again).
- Do not click the "Save animation" to expand it. Leave it folded. Now each time you focus the webp dialog out (for instance alt-tab into your terminal from which you started GIMP), the following line will be outputted on stderr (a few times at once at each focus out):
(file-webp:86013): Gtk-CRITICAL **: 01:03:06.215: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkCheckButton
- If ever you click the "Save animation", then the CRITICAL is never outputted again (even if you fold back the expander afterwards). These only happen before the expander is unfolded at least once.
For more info, this happens on size allocation of the GtkCheckButton-s inside the expander (not the title check button, but the contents option). It seems GTK does not like these child widgets not being realized yet.
Here is a partial backtrace showing the issue:
(gdb) bt
#0 0x00007f2e5bf57a6b in g_log_writer_default () at /lib64/libglib-2.0.so.0
#1 0x00007f2e5bf533a7 in g_log_structured_array () at /lib64/libglib-2.0.so.0
#2 0x00007f2e5bf535a3 in g_log_structured_standard () at /lib64/libglib-2.0.so.0
#3 0x00007f2e5b423eaf in gtk_box_gadget_distribute (gadget=0x1ebb930, for_size=for_size@entry=19, size=-109, size@entry=1, sizes=sizes@entry=0x7fffd2409b80)
at ../../../../../../../dev/src/gtk3/gtk/gtkboxgadget.c:173
#4 0x00007f2e5b42404b in gtk_box_gadget_allocate (gadget=0x1ebb930, allocation=0x7fffd2409c90, baseline=-1, out_clip=0x7fffd2409cb0)
at ../../../../../../../dev/src/gtk3/gtk/gtkboxgadget.c:424
#5 0x00007f2e5b47d15b in gtk_css_gadget_allocate
(gadget=gadget@entry=0x1ebb930, allocation=allocation@entry=0x7fffd2409dc0, baseline=-1, out_clip=out_clip@entry=0x7fffd2409d00)
at ../../../../../../../dev/src/gtk3/gtk/gtkcssgadget.c:790
#6 0x00007f2e5b4550fe in gtk_check_button_size_allocate (widget=0x1e3e620, allocation=0x7fffd2409dc0)
at ../../../../../../../dev/src/gtk3/gtk/gtkcheckbutton.c:503
#7 0x00007f2e5b6baaf7 in gtk_widget_size_allocate_with_baseline (widget=0x1e3e620, allocation=allocation@entry=0x7fffd2409ed0, baseline=<optimized out>,
baseline@entry=-1) at ../../../../../../../dev/src/gtk3/gtk/gtkwidget.c:6175
#8 0x00007f2e5b420d7f in gtk_box_size_allocate_no_center (widget=0x1e3fcd0, allocation=0x7fffd2409f90) at ../../../../../../../dev/src/gtk3/gtk/gtkbox.c:817
#9 0x00007f2e5b421061 in gtk_box_allocate_contents
(gadget=<optimized out>, allocation=0x7fffd2409f90, baseline=<optimized out>, out_clip=0x7fffd2409fb0, unused=<optimized out>)
at ../../../../../../../dev/src/gtk3/gtk/gtkbox.c:1211
#10 0x00007f2e5b47d15b in gtk_css_gadget_allocate
(gadget=0x1ebb320, allocation=allocation@entry=0x7fffd240a0a0, baseline=-1, out_clip=out_clip@entry=0x7fffd240a000)
at ../../../../../../../dev/src/gtk3/gtk/gtkcssgadget.c:790
#11 0x00007f2e5b421b2b in gtk_box_size_allocate (widget=0x1e3fcd0, allocation=0x7fffd240a0a0) at ../../../../../../../dev/src/gtk3/gtk/gtkbox.c:1225
#12 0x00007f2e5b6baaf7 in gtk_widget_size_allocate_with_baseline
(widget=widget@entry=0x1e3fcd0, allocation=allocation@entry=0x7fffd240a120, baseline=<optimized out>)
at ../../../../../../../dev/src/gtk3/gtk/gtkwidget.c:6175
#13 0x00007f2e5b6ba744 in gtk_widget_ensure_allocate (widget=0x1e3fcd0) at ../../../../../../../dev/src/gtk3/gtk/gtkwidget.c:16379
#14 0x00007f2e5b4ccb6f in gtk_expander_forall
(container=<optimized out>, include_internals=<optimized out>, callback=0x7f2e5b6ba670 <gtk_widget_ensure_allocate>, callback_data=0x0)
at ../../../../../../../dev/src/gtk3/gtk/gtkexpander.c:1158
#15 0x00007f2e5b6bace9 in gtk_widget_size_allocate_with_baseline (widget=0x1e72650, allocation=allocation@entry=0x7fffd240a330, baseline=<optimized out>,
baseline@entry=-1) at ../../../../../../../dev/src/gtk3/gtk/gtkwidget.c:6229
#16 0x00007f2e5b420d7f in gtk_box_size_allocate_no_center (widget=0x1e3f490, allocation=0x7fffd240a3f0) at ../../../../../../../dev/src/gtk3/gtk/gtkbox.c:817
#17 0x00007f2e5b421061 in gtk_box_allocate_contents
(gadget=<optimized out>, allocation=0x7fffd240a3f0, baseline=<optimized out>, out_clip=0x7fffd240a410, unused=<optimized out>)
at ../../../../../../../dev/src/gtk3/gtk/gtkbox.c:1211
#18 0x00007f2e5b47d15b in gtk_css_gadget_allocate
--Type <RET> for more, q to quit, c to continue without paging--
(gadget=0x1e440e0, allocation=allocation@entry=0x7fffd240a500, baseline=-1, out_clip=out_clip@entry=0x7fffd240a460)
at ../../../../../../../dev/src/gtk3/gtk/gtkcssgadget.c:790
#19 0x00007f2e5b421b2b in gtk_box_size_allocate (widget=0x1e3f490, allocation=0x7fffd240a500) at ../../../../../../../dev/src/gtk3/gtk/gtkbox.c:1225
#20 0x00007f2e5b6baaf7 in gtk_widget_size_allocate_with_baseline
(widget=widget@entry=0x1e3f490, allocation=allocation@entry=0x7fffd240a570, baseline=<optimized out>, baseline@entry=-1)
at ../../../../../../../dev/src/gtk3/gtk/gtkwidget.c:6175
#21 0x00007f2e5b6baeaa in gtk_widget_size_allocate (widget=widget@entry=0x1e3f490, allocation=allocation@entry=0x7fffd240a570)
at ../../../../../../../dev/src/gtk3/gtk/gtkwidget.c:6256
#22 0x00007f2e5b6d2e2b in gtk_window_size_allocate (widget=0x7fffd240a570, allocation=<optimized out>)
at ../../../../../../../dev/src/gtk3/gtk/gtkwindow.c:7921
#23 0x00007f2e5c03ee2a in g_closure_invoke () at /lib64/libgobject-2.0.so.0
#24 0x00007f2e5c067f9a in signal_emit_unlocked_R.isra.0 () at /lib64/libgobject-2.0.so.0
#25 0x00007f2e5c05bf02 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
#26 0x00007f2e5c05c123 in g_signal_emit () at /lib64/libgobject-2.0.so.0
#27 0x00007f2e5b6bae6f in gtk_widget_size_allocate_with_baseline
(widget=widget@entry=0x1e34360, allocation=allocation@entry=0x7fffd240ab40, baseline=<optimized out>, baseline@entry=-1)
at ../../../../../../../dev/src/gtk3/gtk/gtkwidget.c:6173
#28 0x00007f2e5b6baeaa in gtk_widget_size_allocate (widget=widget@entry=0x1e34360, allocation=allocation@entry=0x7fffd240ab40)
at ../../../../../../../dev/src/gtk3/gtk/gtkwidget.c:6256
#29 0x00007f2e5b6d3780 in gtk_window_move_resize (window=<optimized out>) at ../../../../../../../dev/src/gtk3/gtk/gtkwindow.c:10150
@mayanksuman proposes the explanation:
It seems that size of GtkCheckBox inside an GtkExpander is calculated when it expanded for the first time (otherwise its size remain 0, resulting in this CRITICAL message).
This also seems to agree with my own diagnostic. Maybe we should make a short separate test-case with simpler code to confirm it happens on pure simple GTK code, before creating a bug report there.