Box Widgets added with `add_row` to ExpanderRow can not be removed with `remove`
While contributing to a nim library that wraps GTK and provides the widgets etc. in a more declarative fashion I stumbled over this issue in GTK. I brought it up in discourse where it was stated that this should work, which is why I am filing this issue.
If you try to add a Box GtkWidget to an ExpanderRow via the add_row method and then try to remove it via the remove method it will not remove the Box-Widget from the ExpanderRow.
Instead, it will print a warning to the terminal:
(process:1254433): Gtk-WARNING **: 09:19:59.162: Tried to remove non-child 0x5614565049e0
.
This should be reproducible by making a minimal C example that instantiates an ExpanderRow, adds an empty Box Widget and immediately removes it. I am not able to write such an example at this time as I don't even have basic C knowledge beyond the absolute minimum to bind some C-methods/procs in nim.
Here a snippet of nim-code where I did exactly that:
state.internalWidget = adw_expander_row_new()
let newBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0.cint)
echo "NewBox Pointer: ", newBox.pointer.repr
adw_expander_row_add_row(state.internalWidget, newBox)
adw_expander_row_remove(state.internalWidget, newBox)
For elaboration:
-
echo
is nim’s equivalent to python’s print -
0.cint
is just an int literal in nim’s int type being converted to C’s int type (called cint) -
state.internalWidget
is just a field where we store the pointer to the GTKWidget in, just read it like a variable
This also is reproducible with Label (replacing the gtk_box_new
call with gtk_label_new("")
instead), which is why I currently assume this error applies to all Widgets that aren't inheriting from PreferenceRow
.