Gtk tree model overrides are broken
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 491
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
The code below hangs:
local Gtk = require('lgi').require('Gtk', '2.0')
local Gdk = require('lgi').Gdk
local GObject = require('lgi').GObject
local model = Gtk.ListStore.newv {
[1] = GObject.Type.STRING;
}
local item = model:append()
model:set(item, { "A" })
Interrupting the above script reveals that it spends most of its time recursively calling into the following function:
function Gtk.TreeModel:set(iter, values)
-- Set all values provided by the table
if Gtk.TreePath:is_type_of(iter) then iter = self:get_iter(iter) end
self:set_values(iter, treemodel_prepare_values(self, values))
end
which shouldn't be there at all, as the GtkTreeModel interface doesn't actually guarantee that the model is writeable. Only GtkListStore and GtkTreeStore have set* methods.
(Tangentially, it would be nice if I could call Gtk.ListStore.new in Gtk 2.0 just like I can in Gtk 3.0.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Gtk.TreeModel:set override shown in the issue and compare it with the methods available on GtkListStore and GtkTreeStore. Run the provided Lua reproduction to confirm the recursive call; done means Gtk.TreeModel no longer exposes the invalid set override and the Gtk.ListStore example no longer hangs. The Gtk 2.0 Gtk.ListStore.new request is a separate tangential concern.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100