[pygtk] PyGobject TreeModel selection bug?
Neil Muller
drnlmuller+gtk at gmail.com
Tue Jun 4 19:58:31 WST 2013
On 3 June 2013 20:24, Brent S. Elmer Ph.D. <webe3vt at aim.com> wrote:
> I have an application I wrote using PyGTK that I recently converted
> to use PyGobject introspection. When I try to do something with
> selections in a TreeModel, I get a segmentation fault. The
> corresponding pygtk code works. I have pared down my program to a
> simple test case. I have included the pygtk version that works and the
> PyGobject version that gives a segmentation fault. To see what I mean,
> run the programs and select one or multiple rows then select File->copy
> from the menu. Is this a PyGobject bug or am I doing something wrong?
The problem is the selected_foreach loop here. I'm pretty sure the
issue is there's a discrepency between the references created by gtk
and the python object references in this code path, so you end up with
a path that references something gtk has dropped it's references to.
This is probably a PyGobject bug, but I'm not sure of all the details,
so there may be a reason for the current behaviour.
You can avoid the issue by either expliticly copying the path in your
selection_callback function - i.e, using pathlist.append(path.copy()),
or by using the treeselection's get_selected_rows method.
--
Neil Muller
drnlmuller at gmail.com
I've got a gmail account. Why haven't I become cool?
More information about the pygtk
mailing list