[colord] Python GIR coding problem

Richard Hughes hughsient at gmail.com
Tue Jul 2 00:41:33 PDT 2013


On 2 July 2013 01:35, Sanford Rockowitz <rockowitz at minsoft.com> wrote:
> The problem arises  when trying to access  one device in the list returned
> by client.get_devices_sync(cancellable).   Trying to do dev.connect_sync()
> on the device in the list causes a seg fault.  If I insert the dir(dev)
> line, that fails with the slightly more useful error message:

That looks familiar.

> What am I doing wrong?

Nothing, it's completely my fault. I've just committed this to master
and colord-1-0:
https://github.com/hughsie/colord/commit/e9010f720b8c6a0c2e7bcb6e646a19b473871dcb
[1]

Basically, as we're returning a GPtrArray we want to just unref the
container, not the container and everything in it (as the container
automatically unrefs the contents). If you rebuild your version of
colord with that patch it will work fine. I don't think you can
workaround the bug by doing something like: for d in devices: d.ref()
as I don't think python lets you tweak the refcount like that. On
Ubuntu you might be able to do dev.ref_count = dev.ref_count + 1,
although I can't test this here.

Richard.

[1] I can offer a Fedora 18/19 package if this would make testing easier.


More information about the colord mailing list