Why does `Gtk.TreeViewColumn.set_cell_data_func()` crash my application?
I have the file size in bytes stored in a Gtk.ListStore
and want them to be rendered in a human-readable format by a Gtk.CellRendererText
. Reading the documentation, it seems like Gtk.TreeViewColumn.set_cell_data_func()
is the way to achieve this. Setting it up works without errors, but as soon as a cell is to be rendered, the whole application crashes after several failed assertions.
This is the code I'm using:
self._builder.get_object("ContentList.Size").set_cell_data_func(
Gtk.CellRendererText(),
self.render_formatted_size
)
Exit code is 139, and this is what's printed to stderr:
/usr/lib/python3.7/site-packages/gi/overrides/Gio.py:44: Warning: g_object_freeze_notify: assertion 'G_IS_OBJECT (object)' failed
return Gio.Application.run(self, *args, **kwargs)
/usr/lib/python3.7/site-packages/gi/overrides/Gio.py:44: Warning: g_object_get: assertion 'G_IS_OBJECT (object)' failed
return Gio.Application.run(self, *args, **kwargs)
/usr/lib/python3.7/site-packages/gi/overrides/Gio.py:44: Warning: g_object_set: assertion 'G_IS_OBJECT (object)' failed
return Gio.Application.run(self, *args, **kwargs)
/usr/lib/python3.7/site-packages/gi/overrides/Gio.py:44: Warning: g_object_is_floating: assertion 'G_IS_OBJECT (object)' failed
return Gio.Application.run(self, *args, **kwargs)
/usr/lib/python3.7/site-packages/gi/overrides/Gio.py:44: Warning: g_object_get_qdata: assertion 'G_IS_OBJECT (object)' failed
return Gio.Application.run(self, *args, **kwargs)
Content of self.render_formatted_size
should not matter here. It seems like it's never executed.
Should you need more insights, here's the whole Application:
https://github.com/Bachsau/Mixtool/blob/93bf786b3e714bd2f4e7da6e930866f791d7d6d6/src/main.py
... and a file you may open with it to trigger the error: Demo.mix
PS: Adding additional string columns to the model is not an option, as I want to be able to change display units (SI, IEC) at any time.