Broken ColumnViewRowWidget refcounting during SignalListItemFactory bind
callback in gtk 4.12
#1560
Labels
bug
Something isn't working
bind
callback in gtk 4.12
#1560
Bug description
This is an unusual one. I have some code that was grabbing the grandparents of columnview listcell entries so that I could use them for dragging and drop, since painting a single cell looked bizarre. It worked fine in GTK 4.10, but with 4.12 gtk-rs in particular breaks.
Just calling
drop(child.parent().unwrap().parent())
crashes the application by inadvertently freeing the last reference tochild
's grandparent, which is obviously wrong and should never happen.I am not completely certain this is a gtk-rs bug, but I've tried reproducing this with similar code against gtk itself in C (manually using ref/unref, so if the problem was objects being created with 0 refcount I would have triggered it), and I could not reproduce it despite trying multiple ways.
Reproduction
Apply the patch to
examples/column_view_datagrid/main.rs
and run withcargo run --bin column_view_datagrid
against gtk4.12.The output I get is honestly bizarre. Notably the grandparent refcount is 1, not 2, so as soon as
gp
is dropped the grandparent GtkColumnViewRowWidget is disposed, which breaks everything going forward. The timeout seems necessary as if I exclude it the breakage doesn't happen. Without the timeout, the grandparent refcount is properly 2 in these logs.Grandparent Widget { inner: TypedObjectRef { inner: 0x55ee326f37b0, type: GtkColumnViewRowWidget } }, refcount: 1
should have a refcount of 2, not 1.Backtrace
This is a segfault, and the gdb output isn't terribly interesting either.
patch here
The text was updated successfully, but these errors were encountered: